Skip to content

Commit

Permalink
Merge pull request #87 from jukent/rm-interactive
Browse files Browse the repository at this point in the history
Rm interactive
  • Loading branch information
jukent authored Jan 10, 2025
2 parents b5ca18c + b3f46a3 commit 077a823
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 856 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ Animated plots are great tools for science communication and outreach. We will d

Dynamically rendering, animating, panning & zooming over a plot can be great to increase data fidelity. We will showcase how to use Holoviz technologies with Bokeh backend to create interactive plots, utilizing an unstructured grid data in the Model for Prediction Across Scales (MPAS) format.

Due to environment configuration limitations, interactive plotting will be temporarily be moved to a separate Cookbook.

## Running the Notebooks

You can either run the notebook using [Binder](https://binder.projectpythia.org/) or on your local machine.
Expand Down
6 changes: 0 additions & 6 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,12 @@ dependencies:
- sphinx-pythia-theme
- jupyter-book
- jupyterlab
- jupyter_bokeh
- pandas
- matplotlib
- cartopy
- metpy
- geocat-viz>=2023.10.0
- colorcet
- hvplot
- plotly
- seaborn
- uxarray
- datashader
- geocat-datafiles
- geoviews
- tropycal
114 changes: 1 addition & 113 deletions notebooks/1-comparison.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -260,119 +260,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Plotly\n",
"\n",
"<img src=\"images/logos/plotly.png\" width=250 alt=\"Plotly Logo\"></img>\n",
"\n",
"Plotly is solid choice for interactive plotting. Plotly has functionality in several languags. Here is the [Plotly Python documentation](https://plotly.com/python/).\n",
"\n",
"Here is an example using their \"Express\" functionality:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import plotly.express as px\n",
"\n",
"fig = px.scatter(x=[0, 1, 2, 3, 4], y=[0, 1, 4, 9, 16])\n",
"fig.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Seaborn\n",
"\n",
"<img src=\"images/logos/seaborn.svg\" width=250 alt=\"Seaborn Logo\"></img>\n",
"\n",
"Seaborn is a high level interactive interface for creating statistical visualizations built on matplotlib. Check out the [Seaborn documentation](https://seaborn.pydata.org/).\n",
"\n",
"Here is their [heatmap example](https://seaborn.pydata.org/examples/spreadsheet_heatmap.html):"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import seaborn as sns\n",
"sns.set_theme()\n",
"\n",
"# Load the example flights dataset and convert to long-form\n",
"flights_long = sns.load_dataset(\"flights\")\n",
"flights = flights_long.pivot(index=\"month\", columns=\"year\", values=\"passengers\")\n",
"\n",
"# Draw a heatmap with the numeric values in each cell\n",
"f, ax = plt.subplots(figsize=(9, 6))\n",
"sns.heatmap(flights, annot=True, fmt=\"d\", linewidths=.5, ax=ax)\n",
"\n",
"plt.show();"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Bokeh\n",
"\n",
"<img src=\"images/logos/bokeh.jpeg\" width=250 alt=\"Bokeh Logo\"></img>\n",
"\n",
"Bokeh is a Javascript-powered tool for creating interactive visualizations in modern web browsers. Check out the [Bokeh documentation](https://bokeh.org/)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## UXarray\n",
"\n",
"<img src=\"images/logos/uxarray.png\" width=250 alt=\"UXarray Logo\"></img>\n",
"\n",
"UXarray specializes in unstructured grids, built around [UGRID conventions](https://ugrid-conventions.github.io/ugrid-conventions/) and Xarray syntax. See the [UXarray documentation](https://uxarray.readthedocs.io/en/latest/) and check out the the [UXarray Cookbook](https://projectpythia.org/unstructured-grid-viz-cookbook)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## hvPlot\n",
"\n",
"<img src=\"images/logos/hvplot.svg\" width=250 alt=\"Datashader Logo\"></img>\n",
"\n",
"hvPlot wraps both [Datashader](https://datashader.org/), a graphics pipeline, and [Holoviews](https://holoviews.org/), a tool for bundling data and metadata for intuitive interactive plotting, at a higher level. All 3 tools are by [Holoviz](https://holoviz.org/). Reference the [hvPlot documentation](https://hvplot.holoviz.org/).\n",
"\n",
"Here is a simple example from their [user guide](https://hvplot.holoviz.org/user_guide/Introduction.html):"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import hvplot.pandas\n",
"\n",
"pd.options.plotting.backend = 'holoviews'\n",
"\n",
"index = pd.date_range('1/1/2000', periods=1000)\n",
"df = pd.DataFrame(np.random.randn(1000, 4), index=index, columns=list('ABCD')).cumsum()\n",
"\n",
"df.plot()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This useful diagram from [hvPlot's documentation](https://hvplot.holoviz.org/index.html) details how different high-level tools for data visualization interact.\n",
"\n",
"<img src=\"images/hvplot_diagram.svg\" alt=\"Datashader Logo\"></img>"
"Interactive visualization libraries such as Plotly, UXarray, seaborn, bokeh, and hvplot will be explored in a separate interactive plotting Cookbook."
]
},
{
Expand Down
Loading

0 comments on commit 077a823

Please sign in to comment.