Skip to content
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

Gallery example "Legend": Update regarding input data and multi-column legends #2762

Merged
merged 14 commits into from
Oct 26, 2023

Conversation

yvonnefroehlich
Copy link
Member

@yvonnefroehlich yvonnefroehlich commented Oct 20, 2023

Description of proposed changes

In contrast to the change in PR #2606, it is actually possible to create a multi-column legend for a automatically created legend. This PR corrects the introduction text of the gallery example "Legend".

I feel it would be good to show how to create a horizontal legend, as this is done via the label parameter of Figure.plot, and not via a parameter of the Figure.legend method. For more complicated adjustments of a legend a tutorial seem to make sense. Currently, the same plot is created twice, first with a vertical legend (default) and then with a horizontal legend. However, I am not 100 % happy with this example. I do not like that we plot the same data twice above each other, just with different symbols. And maybe it is not optimal to simply repeat the same plot. Suggestions are welcome 🙂.

Related:

Preveiw: https://pygmt-dev--2762.org.readthedocs.build/en/2762/gallery/embellishments/legend.html

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs.
  • If adding new functionality, add an example to docstrings or tutorials.
  • Use underscores (not hyphens) in names of Python files and directories.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash commands are:

  • /format: automatically format and lint the code
  • /test-gmt-dev: run full tests on the latest GMT development version

@yvonnefroehlich yvonnefroehlich added the documentation Improvements or additions to documentation label Oct 20, 2023
@yvonnefroehlich yvonnefroehlich added this to the 0.11.0 milestone Oct 20, 2023
@yvonnefroehlich yvonnefroehlich self-assigned this Oct 20, 2023
@yvonnefroehlich yvonnefroehlich added the question Further information is requested label Oct 20, 2023
@seisman
Copy link
Member

seisman commented Oct 23, 2023

However, I am not 100 % happy with this example. I do not like that we plot the same data twice above each other, just with different symbols. And maybe it is not optimal to simply repeat the same plot.

I agree. Maybe we can simply create some simple sine/cosine curves instead.

@yvonnefroehlich yvonnefroehlich changed the title Gallery example "Legend": Correct docs and add code regarding multi-column legends WIP: Gallery example "Legend": Correct docs and add code regarding multi-column legends Oct 23, 2023
@yvonnefroehlich
Copy link
Member Author

However, I am not 100 % happy with this example. I do not like that we plot the same data twice above each other, just with different symbols. And maybe it is not optimal to simply repeat the same plot.

I agree. Maybe we can simply create some simple sine/cosine curves instead.

I made some changes regarding the used data (now sine and cosine curves) and the shown legend (now vertical and horizontal legends). I combined this within one figure, a bit similar to the gallery example we have for colorbars. @GenericMappingTools/pygmt-maintainers, what do you think?

@yvonnefroehlich yvonnefroehlich added needs review This PR has higher priority and needs review. and removed question Further information is requested labels Oct 24, 2023
@yvonnefroehlich yvonnefroehlich changed the title WIP: Gallery example "Legend": Correct docs and add code regarding multi-column legends WIP: Gallery example "Legend": Update regarding used data and multi-column legends Oct 25, 2023
@yvonnefroehlich yvonnefroehlich changed the title WIP: Gallery example "Legend": Update regarding used data and multi-column legends WIP: Gallery example "Legend": Update regarding input data and multi-column legends Oct 25, 2023
examples/gallery/embellishments/legend.py Outdated Show resolved Hide resolved
examples/gallery/embellishments/legend.py Outdated Show resolved Hide resolved
examples/gallery/embellishments/legend.py Outdated Show resolved Hide resolved
examples/gallery/embellishments/legend.py Outdated Show resolved Hide resolved
Copy link
Member

@seisman seisman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this PR still WIP? It looks good to me so approve.

@yvonnefroehlich yvonnefroehlich changed the title WIP: Gallery example "Legend": Update regarding input data and multi-column legends Gallery example "Legend": Update regarding input data and multi-column legends Oct 25, 2023
@yvonnefroehlich
Copy link
Member Author

yvonnefroehlich commented Oct 25, 2023

Is this PR still WIP? It looks good to me so approve.

The PR should be finished from my side - updated the title. Just reduced some double blank lines.

@seisman I am sorry for accidentally writing in your comment 🙁 - I reverted this change.

@seisman seisman added final review call This PR requires final review and approval from a second reviewer and removed final review call This PR requires final review and approval from a second reviewer needs review This PR has higher priority and needs review. labels Oct 26, 2023
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Oct 26, 2023
@seisman seisman merged commit f828bc5 into main Oct 26, 2023
7 checks passed
@seisman seisman deleted the correct-gallery-legend branch October 26, 2023 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants