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

Add an example for scatter plots with auto legends #607

Merged
merged 7 commits into from
Sep 27, 2020
Merged

Conversation

seisman
Copy link
Member

@seisman seisman commented Sep 14, 2020

Description of proposed changes

Preview: https://pygmt-git-gallery-scatter.gmt.vercel.app/gallery/plot/scatter.html

Add a new example, modified from https://matplotlib.org/gallery/lines_bars_and_markers/scatter_with_legend.html.

image

To be discussed:

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 adding new functionality, add an example to docstrings or tutorials.

@vercel vercel bot temporarily deployed to Preview September 14, 2020 02:03 Inactive
@weiji14 weiji14 added the documentation Improvements or additions to documentation label Sep 17, 2020
@vercel vercel bot temporarily deployed to Preview September 27, 2020 20:01 Inactive
@seisman
Copy link
Member Author

seisman commented Sep 27, 2020

Is it a good example?

It's a good example for me. It's modified from the matplotlib example, so users can have a direct comparison between pygmt and matplotlib.

Should we have a separate directory/category for "symbols"?

Yes to me. I expect we would have many examples for symbols (different symbol styles, sizes, colors et al.). It's better to group the "symbols" examples together.

@seisman seisman marked this pull request as ready for review September 27, 2020 20:18
@seisman seisman added this to the 0.2.1 milestone Sep 27, 2020
Copy link
Member

@weiji14 weiji14 left a comment

Choose a reason for hiding this comment

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

Is it a good example?

It's a good example for me. It's modified from the matplotlib example, so users can have a direct comparison between pygmt and matplotlib.

Fair enough. I think our problem now is that there are too few examples, so the more we have the better! Showcasing the transparency in this example is also good!

Should we have a separate directory/category for "symbols"?

Yes to me. I expect we would have many examples for symbols (different symbol styles, sizes, colors et al.). It's better to group the "symbols" examples together.

Maybe we could place it under the user guide, similar to what is being done for projections at https://www.pygmt.org/v0.2.0/projections/index.html? But that can be discussed in another issue/PR.

transparency=70, # set transparency level for all symbols
)

fig.legend(transparency=30) # set transparency level for legends
Copy link
Member

Choose a reason for hiding this comment

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

Ah, this is cool, I hadn't thought of using transparent legend boxes before!

@seisman seisman merged commit 94b23a2 into master Sep 27, 2020
@seisman seisman deleted the gallery/scatter branch September 27, 2020 22:17
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.

2 participants