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

Two-dimensional scatter plot #317

Merged
merged 44 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
0965a1a
start making scatter plot infrastructure
nvaytet Sep 27, 2023
4963a59
first draft scatter plot
nvaytet Feb 2, 2024
3dcbbb1
return to separate scatter and image views
nvaytet Feb 13, 2024
b239fef
Merge branch 'main' into scatter2d
nvaytet Feb 28, 2024
492b6dc
scatter plot working with multiple inputs, colorbar and sizes
nvaytet Feb 28, 2024
54f1c7e
start updating docs
nvaytet Feb 28, 2024
6097129
begin cleanup
nvaytet Feb 28, 2024
081239d
start making common graphical view
nvaytet Feb 29, 2024
ce2f19f
use graphicalview in all 2d plots
nvaytet Feb 29, 2024
be81184
some cleanup
nvaytet Feb 29, 2024
a9dfc34
start adding masks
nvaytet Feb 29, 2024
e22a177
fix masks, and fix when different units are used on different axes
nvaytet Mar 1, 2024
d8c46d4
add docstrings and deprecate figureXd
nvaytet Mar 1, 2024
4d656f7
start adding tests
nvaytet Mar 1, 2024
abd8608
add scatterview tests
nvaytet Mar 1, 2024
9e2b198
remove code duplication
nvaytet Mar 1, 2024
44542f2
add mpl scatter tests
nvaytet Mar 1, 2024
409e978
fix more tests
nvaytet Mar 1, 2024
5fa44ad
fix even more tests
nvaytet Mar 1, 2024
5c0f59e
fix more tests
nvaytet Mar 1, 2024
fd79d6b
more tests
nvaytet Mar 1, 2024
c4ba769
small superplot refactor
nvaytet Mar 2, 2024
79296e0
fix mpl canvas layout
nvaytet Mar 4, 2024
3e6f4c8
refactor superplot
nvaytet Mar 4, 2024
eed7b8d
update xyplot
nvaytet Mar 4, 2024
30fd072
fix widget test
nvaytet Mar 4, 2024
b3ffb44
static
nvaytet Mar 4, 2024
4dfb0d7
fix docs
nvaytet Mar 4, 2024
1d55673
replace large svg with png
nvaytet Mar 4, 2024
86a8b77
remove unused file
nvaytet Mar 4, 2024
5fdcfaa
Merge branch 'main' into scatter2d
nvaytet Apr 3, 2024
d2bce3a
Merge branch 'scatter2d' of github.com:scipp/plopp into scatter2d
nvaytet Apr 3, 2024
d15201e
avoid clash with args name and update docstrings
nvaytet Apr 3, 2024
f2e7c94
fix bad args passed to colormapper
nvaytet Apr 8, 2024
501f5a4
Merge branch 'main' into scatter2d
nvaytet Apr 8, 2024
91f713b
update version number in admonitions
nvaytet Apr 8, 2024
e37e469
copyright years
nvaytet Apr 8, 2024
19045a6
better implementation of update
nvaytet Apr 8, 2024
7f8a8f4
add docstring to graphicalview
nvaytet Apr 8, 2024
135cc32
fix overflow layout for interactive figures
nvaytet Apr 8, 2024
b9ece09
docs fixes
nvaytet Apr 8, 2024
bb2fceb
more docs fixes
nvaytet Apr 8, 2024
870ef17
fix links and generate thumbnail
nvaytet Apr 8, 2024
3398d28
update api reference
nvaytet Apr 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/_static/plot-types/scatter-plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions docs/api-reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
slicer
superplot
inspector
scatter
scatter3d
xyplot
```
Expand Down Expand Up @@ -40,8 +41,13 @@
graphics.figure1d
graphics.figure2d
graphics.figure3d
graphics.imagefigure
graphics.ImageView
graphics.linefigure
graphics.LineView
graphics.scatterfigure
graphics.ScatterView
graphics.scatter3dfigure
graphics.Scatter3dView
graphics.tiled
```
Expand Down
1 change: 1 addition & 0 deletions docs/api-reference/matplotlib.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
backends.matplotlib.canvas.Canvas
backends.matplotlib.line.Line
backends.matplotlib.image.Image
backends.matplotlib.scatter.Scatter
backends.matplotlib.static.StaticFig
backends.matplotlib.interactive.InteractiveFig
backends.matplotlib.tiled.Tiled
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@
'peeling-layers',
'tiled-random-samples',
'polar-plots',
'updating-scatter',
]
nbsphinx_thumbnails = {
os.path.join(notebook_root, notebook): os.path.join(
Expand Down
3 changes: 2 additions & 1 deletion docs/gallery/index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"* [Interactive masking](interactive-masking.ipynb)\n",
"* [Peeling off the layers](peeling-layers.ipynb)\n",
"* [Tiled random sample histograms](tiled-random-samples.ipynb)\n",
"* [Polar plots](polar-plots.ipynb)"
"* [Polar plots](polar-plots.ipynb)\n",
"* [Updating scatter points](updating-scatter.ipynb)"
]
}
],
Expand Down
3 changes: 1 addition & 2 deletions docs/gallery/tiled-random-samples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
Expand Down
83 changes: 83 additions & 0 deletions docs/gallery/updating-scatter.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "dfd6576d-c0ad-44cd-9f72-8d93b35b9632",
"metadata": {},
"source": [
"# Updating scatter points\n",
"\n",
"This notebook will show examples on how to update positions and colors of scatter points using interactive widgets."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "dceddbd2-09ea-43cd-a9ba-0510ccfe1560",
"metadata": {},
"outputs": [],
"source": [
"import plopp as pp\n",
"import scipp as sc\n",
"import ipywidgets as ipw\n",
"%matplotlib widget\n",
"\n",
"a = pp.Node(pp.data.scatter())\n",
"b = pp.Node(pp.data.scatter(seed=2) * 10.0)\n",
"\n",
"slider = ipw.FloatSlider(min=0, max=60, value=30,\n",
" description='Position of orange group',\n",
" style={'description_width': 'initial'},\n",
" layout={'width': '500px'})\n",
"slider_node = pp.widget_node(slider)\n",
"\n",
"@pp.node\n",
"def move(da, x):\n",
" out = da.copy(deep=False)\n",
" out.coords['x'] = da.coords['x'] + sc.scalar(x, unit=da.coords['x'].unit)\n",
" return out\n",
"\n",
"move_node = move(da=b, x=slider_node)\n",
"\n",
"f = pp.scatter({'a': a, 'b': move_node}, cbar=False)\n",
"f.bottom_bar.add(slider)\n",
"f.canvas.xrange = [-40, 100]\n",
"f"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ae71757f-b903-40eb-add8-528a0e7eb05b",
"metadata": {
"nbsphinx": "hidden"
},
"outputs": [],
"source": [
"# This cell is used to generate the thumbnail for the docs gallery.\n",
"# It is hidden from the online documentation.\n",
"f.save('../_static/gallery/updating-scatter-thumbnail.png')"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
17 changes: 14 additions & 3 deletions docs/user-guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,22 @@ getting-started/saving-figures

:::

::::{grid-item-card} Slicer plot
:link: plot-types/slicer-plot.ipynb
:img-bottom: ../_static/plot-types/slicer-plot.png
::::{grid-item-card} Scatter plot
:link: plot-types/scatter-plot.ipynb
:img-bottom: ../_static/plot-types/scatter-plot.png

:::

::::

::::{grid} 3

:::{grid-item-card} Slicer plot
:link: plot-types/slicer-plot.ipynb
:img-bottom: ../_static/plot-types/slicer-plot.png

:::

:::{grid-item-card} Inspector plot
:link: plot-types/inspector-plot.ipynb
:img-bottom: ../_static/plot-types/inspector-plot.png
Expand All @@ -79,6 +85,10 @@ getting-started/saving-figures

:::

::::

::::{grid} 3

:::{grid-item-card} Scatter 3D plot
:link: plot-types/scatter3d-plot.ipynb
:img-bottom: ../_static/plot-types/scatter3d-plot.png
Expand All @@ -97,6 +107,7 @@ plot-types/image-plot
plot-types/slicer-plot
plot-types/inspector-plot
plot-types/super-plot
plot-types/scatter-plot
plot-types/scatter3d-plot
```

Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/plot-types/image-plot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"source": [
"## Basic image plot\n",
"\n",
"As with one-dimensional data, plotting two-dimensional data is done using the [plot](../../reference/generated/plopp.plot.rst) function."
"As with one-dimensional data, plotting two-dimensional data is done using the [plot](../../generated/plopp.plot.rst) function."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/plot-types/line-plot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"source": [
"## Basic line plot\n",
"\n",
"The most common way to plot data with Plopp is to use the [plot](../../reference/generated/plopp.plot.rst) function.\n",
"The most common way to plot data with Plopp is to use the [plot](../../generated/plopp.plot.rst) function.\n",
"This can either be done using the `plopp.plot()` free function,\n",
"or calling the `.plot()` method on a Scipp data object (both are equivalent)."
]
Expand Down
Loading
Loading