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 tutorial to show interactive data visualization via 'panel' #2498

Merged
merged 54 commits into from
May 1, 2023

Conversation

yvonnefroehlich
Copy link
Member

@yvonnefroehlich yvonnefroehlich commented Apr 16, 2023

Description of proposed changes

This PR aims to add a tutorial showing how to use the library panel to create an interactive dashboard with PyGMT.

  • static map
  • dynamic map
  • add a grid, e.g., earth_relief ?
  • add panel as a dependency
  • write nice documentation

The tutorial is based on this EGU 2022 Short Course example and #2455 (comment)

A global map with varying central longitude (similar to this animation https://docs.generic-mapping-tools.org/latest/animations/anim07.html but coastlines are enough)

Fixes #2455

Preview: https://pygmt-dev--2498.org.readthedocs.build/en/2498/tutorials/advanced/working_with_panel.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 Apr 16, 2023
@yvonnefroehlich yvonnefroehlich added this to the 0.10.0 milestone Apr 16, 2023
@yvonnefroehlich yvonnefroehlich self-assigned this Apr 16, 2023
@yvonnefroehlich
Copy link
Member Author

/format

@yvonnefroehlich yvonnefroehlich changed the title Add tutorial to show usage of 'panel' for interactive data visualization WIP: Add tutorial to show usage of 'panel' for interactive data visualization Apr 16, 2023
@yvonnefroehlich yvonnefroehlich marked this pull request as draft April 16, 2023 10:57
@yvonnefroehlich yvonnefroehlich changed the title WIP: Add tutorial to show usage of 'panel' for interactive data visualization WIP: Add tutorial to show interactive data visualization via 'panel' Apr 16, 2023
pyproject.toml Outdated Show resolved Hide resolved
doc/install.rst Outdated Show resolved Hide resolved
examples/tutorials/advanced/panel_extension.py Outdated Show resolved Hide resolved
environment.yml Outdated Show resolved Hide resolved
examples/tutorials/advanced/panel_extension.py Outdated Show resolved Hide resolved
@yvonnefroehlich yvonnefroehlich changed the title WIP: Add tutorial to show interactive data visualization via 'panel' Add tutorial to show interactive data visualization via 'panel' Apr 25, 2023
@yvonnefroehlich yvonnefroehlich marked this pull request as ready for review April 25, 2023 06:59
Co-authored-by: Dongdong Tian <[email protected]>
@seisman seisman added final review call This PR requires final review and approval from a second reviewer and removed needs review This PR has higher priority and needs review. labels Apr 25, 2023
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.

Looks good to me except one minor comment.

@weiji14
Copy link
Member

weiji14 commented Apr 27, 2023

The EGU 2022 example shows an image with a slider (although it's static),
but in this example, it shows nothing:
Maybe some panel configurations are missing?

I think this is because the EGU 2022 example is a Jupyter notebook, but this example is a normal Python script.

Is there a sphinx extension or something to have the slider show up? I feel like there should be some way...

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 to me except the comment of @weiji14. If it would be possible to show the slider in some way this would be great. Apart from that, great work @yvonnefroehlich.

@seisman
Copy link
Member

seisman commented Apr 28, 2023

The EGU 2022 example shows an image with a slider (although it's static),
but in this example, it shows nothing:
Maybe some panel configurations are missing?

I think this is because the EGU 2022 example is a Jupyter notebook, but this example is a normal Python script.

Is there a sphinx extension or something to have the slider show up? I feel like there should be some way...

I don't think it's possible with our current docs settings.

When we build the docs, the Sphinx-Gallery plugin executes the .py gallery script and captures the outputs. Then it converts the .py script and the output into a ReST file, and also converts the .py script into a Jupyter Notebook. The generated ReST file is included as part of the Sphinx documentation and is rendered into an HTML file.

Thus, the main problem is that Sphinx-Gallery can't capture the "slider" generated by Panel.

@seisman
Copy link
Member

seisman commented Apr 28, 2023

The EGU 2022 example shows an image with a slider (although it's static),
but in this example, it shows nothing:
Maybe some panel configurations are missing?

I think this is because the EGU 2022 example is a Jupyter notebook, but this example is a normal Python script.

Is there a sphinx extension or something to have the slider show up? I feel like there should be some way...

Maybe we can add some screenshots (with the slider) as a workaround.

@seisman
Copy link
Member

seisman commented May 1, 2023

The EGU 2022 example shows an image with a slider (although it's static),
but in this example, it shows nothing:
Maybe some panel configurations are missing?

I think this is because the EGU 2022 example is a Jupyter notebook, but this example is a normal Python script.

Is there a sphinx extension or something to have the slider show up? I feel like there should be some way...

I don't think it's possible with our current docs settings.

When we build the docs, the Sphinx-Gallery plugin executes the .py gallery script and captures the outputs. Then it converts the .py script and the output into a ReST file, and also converts the .py script into a Jupyter Notebook. The generated ReST file is included as part of the Sphinx documentation and is rendered into an HTML file.

Thus, the main problem is that Sphinx-Gallery can't capture the "slider" generated by Panel.

@weiji14 Any more comments?

@weiji14
Copy link
Member

weiji14 commented May 1, 2023

Ok to merge first, we can see if there's a way to show the slider later.

@seisman seisman merged commit bdf5b1e into main May 1, 2023
@seisman seisman deleted the add-tutorial-panel branch May 1, 2023 07:39
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label May 1, 2023
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.

Add an gallery example/tutorial for interactive data visualization using Panel?
5 participants