GeezerVison is showing github.com — legends, part 1 by kushalkolar · Pull Request #406 · fastplotlib/fastplotlib
Conversation
kushalkolar
commented
Feb 19, 2024
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
kushalkolar
commented
Feb 20, 2024
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
got some very basic stuff working, can add simple LineGraphics to the legend

Changing label and auto-update of colors and thickness works

|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I should determine a way to make a sorting method for LegendItems in space (based on the size of each) and then organize into an optimal column, row or grid of items. Get the bbox for all LegendItems and set the Legend mesh to the bbox.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
If legend is placed in the main plot area scale the text size and spacing based on current scene bbox.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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 plan to have something like plot.add_legend(), that would take a plot_area and auto generate a legend based on existing graphics in the plot?
Notes:
- Interesting functionality, if I don't specify a dock to put the legend in, it places it in the middle of the plot. Should we have a default dock to use ("top" or "right") if someone just passes the plot?
- Also, if I don't change the size of the dock before adding the legend, it doesn't appear? Should we automatically change the size of the dock area that the legend is being added to?
- Legend location: it appears like the legend is not centered in the middle of the plot.

Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
I see here you provided images exemplifying use, I think we should add a legends.ipynb.
@kushalkolar thoughts?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Interesting functionality, if I don't specify a dock to put the legend in, it places it in the middle of the plot. Should we have a default dock to use ("top" or "right") if someone just passes the plot?
I see you can pass a Plot, Dock, or Subplot. My only worry is that when I just passed the same plot that my data is in it put the legend over the graphic. Guess maybe it is up to the user to know that you can put legend in a plot or subplot by itself, or you can put it in a dock.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Is there a plan to have something like plot.add_legend(), that would take a plot_area and auto generate a legend based on existing graphics in the plot?
We can think about this later once we have all the legend functionality we want.
- Interesting functionality, if I don't specify a dock to put the legend in, it places it in the middle of the plot. Should we have a default dock to use ("top" or "right") if someone just passes the plot?
Nope, it can make sense to put the legend in the main plot area too, the user can move them out of the way of existing graphics if required.
- Also, if I don't change the size of the dock before adding the legend, it doesn't appear? Should we automatically change the size of the dock area that the legend is being added to?
Done
- Legend location: it appears like the legend is not centered in the middle of the plot.
We can fix this later XD
I see here you provided images exemplifying use, I think we should add a legends.ipynb.
We can do this after implementing all legend functionality that we want, basically when we fully resolve #403
it is up to the user to know that you can put legend in a plot or subplot by itself, or you can put it in a dock.
Yup!
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Is there a plan to have something like plot.add_legend(),
Now after the recent References refactor I realize this is probably the best way to do it, keep the API uniform. Can properly look into it after or during axes.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
clewis7
clewis7 left review comments
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|