Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

legends, part 1 #406

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

Merged
merged 25 commits into from
Feb 29, 2024
Merged

legends, part 1 #406

merged 25 commits into from
Feb 29, 2024

Conversation

kushalkolar
Copy link
Member

@kushalkolar kushalkolar commented Feb 19, 2024

starts #403

major WIP

@kushalkolar kushalkolar mentioned this pull request Feb 19, 2024
@kushalkolar
Copy link
Member Author

kushalkolar commented Feb 20, 2024

got some very basic stuff working, can add simple LineGraphics to the legend

image

Changing label and auto-update of colors and thickness works

image

@kushalkolar
Copy link
Member Author

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.

@kushalkolar
Copy link
Member Author

If legend is placed in the main plot area scale the text size and spacing based on current scene bbox.

@kushalkolar kushalkolar changed the title legends legends, part 1 Feb 27, 2024
@kushalkolar kushalkolar marked this pull request as ready for review February 27, 2024 05:22
Copy link
Member

@clewis7 clewis7 left a 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:

  1. 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?
  2. 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?
  3. Legend location: it appears like the legend is not centered in the middle of the plot.
    image

fastplotlib/layouts/_plot_area.py Show resolved Hide resolved
fastplotlib/legends/legend.py Show resolved Hide resolved
@clewis7
Copy link
Member

clewis7 commented Feb 28, 2024

I see here you provided images exemplifying use, I think we should add a legends.ipynb.

@kushalkolar thoughts?

@clewis7
Copy link
Member

clewis7 commented Feb 28, 2024

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.

fastplotlib/legends/legend.py Outdated Show resolved Hide resolved
fastplotlib/legends/legend.py Show resolved Hide resolved
@kushalkolar
Copy link
Member Author

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.

  1. 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.

  1. 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

  1. 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!

@kushalkolar kushalkolar merged commit 8919d7c into main Feb 29, 2024
@kushalkolar kushalkolar deleted the legends branch March 4, 2024 12:17
@kushalkolar
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.