-
Notifications
You must be signed in to change notification settings - Fork 615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Visual: Circle #2440
base: main
Are you sure you want to change the base?
New Visual: Circle #2440
Conversation
|
||
Parameters | ||
---------- | ||
corners : int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand, why "corners"? Are these the "wedges" of the pie chart? What units are these in? Degrees?
Oh wait, it says histogram, but do you ever run the data through a histogram? No wait, this is an integer?
Oh, looking at the example so color
is really what determines the size of the wedges? And corners
is more of a "resolution"? No...wait...I'm very confused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes corners are a bit confosing I called it corners because its not actually a circle its a "n-gon", like a octogon or a pentagon. For example an octogon would have 8 corners, and a pentagon would have 5. For the pie chart I set it to 1000, so its more like a 1000-gon. So yes its made up of wedges, and each wedge can be individualy colored.
Regarding the histogram thats my bad I made this while having covid and lying in bed and I copyed the histogram.py Parameters comment and forgot to change the line with the histogram - im sorry for the confusion
for i in range(corners + 1): | ||
if i != 0: | ||
y = radius * math.cos(last_angle) | ||
x = radius * math.sin(last_angle) | ||
vertices.append((x, y)) | ||
vertices.append((0, 0)) | ||
angle = 2 * math.pi * i / corners | ||
y = radius * math.cos(angle) | ||
x = radius * math.sin(angle) | ||
vertices.append((x, y)) | ||
last_angle = angle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to do this without the for loop? For a start, you could remove the if
and do range(1, corners + 1)
and that would remove an entire indentation level. Next, if i
(better variable name?) was np.arange(corners)
could we do the same type of math and then have vertices = np.zeros((corners * 3, 3))
and do some level of vertices[::3, :2] = (radius * np.sin(angles), radius * np.cos(angles))
and then something similar for vertices[2::3, :2]
. I might have an off-by-one on the size of i
and need to calculate the angles
, but otherwise I think that makes sense. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didnt explore it i just needed it quick, and because i'm not very good generationg the verticies arrays i took the easy route. However your suggestion should be a good start,
Interesting, interesting, interesting. Ok, so my instinct is to say For the
Another optional parameter: starting angle of first wedge (default 0 degrees is the x-axis).
|
Yes that would make sense, but it's not quite clear to me if you what this visual to be a pie chart?, I just created it to be a circle. The pie chart is just an example - I'd say the pie chart should be in plotwidget.py |
You can already do circles with Markers so I guess I'm not sure what purpose this serves except as a divided pie chart circle. Let me know if you had other ideas. |
I agree that this seems to be a (very useful) n-gon or pie chart addition, rather than a straight up circle. I would reach out to the |
Sorry for the late response I'm busy studying. Anyway, I didnt know that Marker could be used to create circles, and yes I created this visual because I wanted a pie chart, but I wanted it also to be general purpose. However if you prefer it to be just a piechart visual or an n-gon generator, I'd have no issue with that. |
I think the main thing is that having a generic "circle" visual where the main interface is "here's how you split a circle into N wedges", means this isn't a generic circle anymore. A generic circle would be |
As ever just a small new visual, since every graphing api should have a circle.
Anyway I just had to have it for pie charts.
Hope you like it :)