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

Reorganize gallery examples #995

Merged
merged 31 commits into from
Mar 12, 2021
Merged

Reorganize gallery examples #995

merged 31 commits into from
Mar 12, 2021

Conversation

willschlitzer
Copy link
Contributor

This pull request reorganizes the gallery examples to have more specific categories.

Fixes #876

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.

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

@willschlitzer willschlitzer added this to the 0.3.1 milestone Mar 3, 2021
@willschlitzer willschlitzer added the documentation Improvements or additions to documentation label Mar 3, 2021
@seisman
Copy link
Member

seisman commented Mar 3, 2021

@willschlitzer Thanks for opening the PR. It would be much easier to discuss how we want to group gallery examples by viewing what any new designs look like.

To make it work, you also need to update the following lines in doc/conf.py:

pygmt/doc/conf.py

Lines 72 to 85 in 55c6176

"subsection_order": ExplicitOrder(
[
"../examples/gallery/line",
"../examples/gallery/coast",
"../examples/gallery/plot",
"../examples/gallery/grid",
"../examples/projections/azim",
"../examples/projections/conic",
"../examples/projections/cyl",
"../examples/projections/misc",
"../examples/projections/nongeo",
"../examples/projections/table",
]
),
.

@seisman
Copy link
Member

seisman commented Mar 4, 2021

Ping @GenericMappingTools/python @GenericMappingTools/python-maintainers for comments.

@maxrjones
Copy link
Member

Looks great! Based on #967 and the great response to @liamtoney's ROSES tutorial, I hope we can eventually have a whole seismology gallery section!

@seisman
Copy link
Member

seisman commented Mar 4, 2021

Perhaps rename the directory gallery/line to gallery/lines?

@weiji14
Copy link
Member

weiji14 commented Mar 5, 2021

Kinda unrelated, but can we rename one of the inset.py files, one which is for the gallery and one for the tutorial, because there is a warning message:

`WARNING: Duplicate example file name(s) found. Having duplicate file names will break some links. List of files: ['../examples/tutorials/inset.py']

@core-man
Copy link
Member

core-man commented Mar 5, 2021

Looks great~

Do Colorbar and Legend only belong to Map and map elements? But I've no better category for them. Shall we add a category called Additional figure elements or Unclarified?

There is a category called Images, symbols, and markers. Shall we move Images to an individual category? If yes, which ones are images in the current category, Images or EPS files on maps?

By the way, shall we rename this gallery to something like Images or EPS files on figures since we can put them on any figure instead of only a map, right?

Referring to #876 (comment) and #876 (comment), how about the following content for the current galleries?

  • Maps and map elements
  • Lines and vectors
  • Symbols and markers
  • Images and contours (NEW)
  • 3D plots
  • Additional figure elements or Unclarified (NEW)

@seisman
Copy link
Member

seisman commented Mar 5, 2021

There is a category called Images, symbols, and markers. Shall we move Images to an individual category? If yes, which ones are images in the current category, Images or EPS files on maps?

I agree we should have a separate category for images. As I commented in #876, I think the category name could be "Images and contours" or "Images, contours and fields", like matplotlib (https://matplotlib.org/stable/gallery/index.html#images-contours-and-fields).

By the way, shall we rename this gallery to something like Images or EPS files on figures since we can put them on any figure instead of only a map, right?

Sounds good. Actually, Figure.image() can recognize most image formats (png, jpg, eps, pdf et al.) via GDAL. So I think we could just say "Put images on figures" or similar.

@core-man
Copy link
Member

core-man commented Mar 5, 2021

Can we control the figure order in each category? For example, in Maps and map elements gallery, the order is now: Political Boundaries, Colorbar, Inset, ..., Sampling along tracks. It seems that we can have a better order so that some related examples can be put together, e.g., Political Boundaries, Color land and water, Shorelines seem related to each other.

@willschlitzer
Copy link
Contributor Author

Kinda unrelated, but can we rename one of the inset.py files, one which is for the gallery and one for the tutorial, because there is a warning message:

`WARNING: Duplicate example file name(s) found. Having duplicate file names will break some links. List of files: ['../examples/tutorials/inset.py']

Done in 965dbf3

@seisman
Copy link
Member

seisman commented Mar 5, 2021

Can we control the figure order in each category? For example, in Maps and map elements gallery, the order is now: Political Boundaries, Colorbar, Inset, ..., Sampling along tracks. It seems that we can have a better order so that some related examples can be put together, e.g., Political Boundaries, Color land and water, Shorelines seem related to each other.

There are different ways to sort the examples in one section (see https://sphinx-gallery.github.io/stable/configuration.html#within-gallery-order).
Currently, they are sorted by file names, but perhaps it makes more sense to sort by Title (ExampleTitleSortKey)?

"within_subsection_order": FileNameSortKey,

@weiji14 weiji14 mentioned this pull request Mar 7, 2021
5 tasks
@seisman
Copy link
Member

seisman commented Mar 11, 2021

I just pushed a few changes to this branch:

  • f953632: Rename two python files using underscores
  • e0e507d + ce706f4: Rename "inset-tutorial.py" to "insets.py"
  • f6622f8: Fix broken references due to recent renamings
  • e3c8c10: Rename the directory "3d-plots" to "3d_plots" (also use underscores for directories)

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.

This PR now looks good to me.

Ping @GenericMappingTools/python @GenericMappingTools/python-contributors
@GenericMappingTools/python-maintainers for comments and approvals.

Copy link
Member

@maxrjones maxrjones left a comment

Choose a reason for hiding this comment

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

Nice!

Copy link
Member

@michaelgrund michaelgrund left a comment

Choose a reason for hiding this comment

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

Looks good! No further suggestions.

@core-man
Copy link
Member

Great~

@willschlitzer
Copy link
Contributor Author

@weiji14 Can you confirm that you are no longer requesting changes?

@seisman
Copy link
Member

seisman commented Mar 12, 2021

Ping @weiji14 to give this PR a final review.

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.

Oops, thanks for the ping. Juggling too much on my plate recently (handling a release on another Python package and uni stuff). Just one comment.

examples/gallery/images/README.txt Show resolved Hide resolved
@seisman seisman merged commit b2b3d1f into master Mar 12, 2021
@seisman seisman deleted the reorganize-gallery branch March 12, 2021 05:13
This was referenced Mar 14, 2021
sixy6e pushed a commit to sixy6e/pygmt that referenced this pull request Dec 21, 2022
Changes in this PR:

- Reorganizes the gallery examples to have more specific categories
- Sort gallery examples by "title" in each subsection
- Use underscores in file and directory names

Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Michael Grund <michael_grund@gmx.de>
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
Co-authored-by: Yao Jiayuan <coreman.seism@gmail.com>
Co-authored-by: Meghan Jones <meghanj@hawaii.edu>
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.

Better categories for gallery examples
6 participants