Skip to content

Commit

Permalink
Merge pull request #332 from scipp/remove-deprecated-figures
Browse files Browse the repository at this point in the history
Replace deprecated figures in docs notebooks with the new ones
  • Loading branch information
nvaytet authored Apr 19, 2024
2 parents 9dfe92a + a81296c commit ed312e6
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion docs/gallery/interactive-masking.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
"\n",
"masking_node = pp.Node(apply_masks, data_node)\n",
"\n",
"fig = pp.figure2d(masking_node, norm='log')\n",
"fig = pp.imagefigure(masking_node, norm='log')\n",
"\n",
"r = RectangleTool(\n",
" figure=fig, input_node=data_node, func=define_mask, destination=masking_node\n",
Expand Down
10 changes: 5 additions & 5 deletions docs/gallery/masking-a-range.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@
"sum_node = pp.Node(sc.sum, mask_node, dim=ydim)\n",
"\n",
"# Make figures\n",
"fig2d = pp.figure2d(mask_node, norm='log')\n",
"fig1d = pp.figure1d(sum_node, grid=True, ls='solid', marker='')\n",
"ipw.VBox([slider, fig2d, fig1d])"
"image = pp.imagefigure(mask_node, norm='log')\n",
"lines = pp.linefigure(sum_node, grid=True, ls='solid', marker='')\n",
"ipw.VBox([slider, image, lines])"
]
},
{
Expand All @@ -142,7 +142,7 @@
},
"outputs": [],
"source": [
"pp.show_graph(fig1d)"
"pp.show_graph(lines)"
]
},
{
Expand All @@ -161,7 +161,7 @@
"source": [
"# This cell is used to generate the thumbnail for the docs gallery.\n",
"# It is hidden from the online documentation.\n",
"fig2d.save('../_static/gallery/masking-a-range-thumbnail.png')"
"image.save('../_static/gallery/masking-a-range-thumbnail.png')"
]
}
],
Expand Down
4 changes: 2 additions & 2 deletions docs/gallery/nyc-taxi.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"slice_node = pp.Node(lambda da, ind: da['hour', ind], da=data, ind=slider_node)\n",
"\n",
"# Add a 2D figure to show the NYC map\n",
"fig2d = pp.figure2d(slice_node, norm='log')\n",
"fig2d = pp.imagefigure(slice_node, norm='log')\n",
"\n",
"# Add a node after the slicing to sum along the latitude dimension\n",
"sum_lat = pp.Node(sc.sum, slice_node, dim='latitude')\n",
Expand All @@ -63,7 +63,7 @@
"smooth = pp.Node(gaussian_filter, sum_lat, sigma=5)\n",
"\n",
"# Add a 1D figure that will display both raw sum and smoothed data\n",
"fig1d = pp.figure1d(sum_lat, smooth, norm='log')\n",
"fig1d = pp.linefigure(sum_lat, smooth, norm='log')\n",
"\n",
"widgets.Box([slider, fig2d, fig1d]) # Container box"
]
Expand Down
4 changes: 2 additions & 2 deletions docs/gallery/rectangle-selection.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@
"\n",
"data_node = pp.Node(da)\n",
"\n",
"f2d = pp.figure2d(data_node, norm='log')\n",
"f1d = pp.figure1d()\n",
"f2d = pp.imagefigure(data_node, norm='log')\n",
"f1d = pp.linefigure()\n",
"\n",
"r = RectangleTool(figure=f2d, input_node=data_node, func=vertical_sum, destination=f1d)\n",
"f2d.toolbar['roi'] = r\n",
Expand Down
6 changes: 3 additions & 3 deletions docs/gallery/scatter3d-with-slider.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"source": [
"We then construct our interface with a slider,\n",
"a node that slices our data at the index of the slider,\n",
"and a `figure3d`."
"and a `scatter3dfigure`."
]
},
{
Expand All @@ -92,7 +92,7 @@
"\n",
"slice_node = pw.slice_dims(data_array=da, slices=slider_node)\n",
"\n",
"fig = pp.figure3d(slice_node, pixel_size=0.3)\n",
"fig = pp.scatter3dfigure(slice_node, pixel_size=0.3)\n",
"\n",
"# Set slider in the middle so panel isn't all dark\n",
"slider.controls['time']['slider'].value = 23\n",
Expand All @@ -116,7 +116,7 @@
"\n",
"sum_slices = pp.Node(sc.sum, slice_node, dim='time')\n",
"\n",
"fig = pp.figure3d(sum_slices, pixel_size=0.3)\n",
"fig = pp.scatter3dfigure(sum_slices, pixel_size=0.3)\n",
"\n",
"# Set slider in the middle so panel isn't all dark\n",
"slider.controls['time']['slider'].value = (0, 12)\n",
Expand Down
18 changes: 9 additions & 9 deletions docs/user-guide/customization/custom-interfaces.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"source": [
"data_node = pp.Node(da)\n",
"\n",
"fig = pp.figure2d(data_node)\n",
"fig = pp.imagefigure(data_node)\n",
"\n",
"pp.show_graph(data_node) # display the graph"
]
Expand Down Expand Up @@ -169,7 +169,7 @@
"\n",
"smooth_node = pp.Node(gaussian_filter, data_node, sigma=5)\n",
"\n",
"fig = pp.figure2d(smooth_node)"
"fig = pp.imagefigure(smooth_node)"
]
},
{
Expand Down Expand Up @@ -239,7 +239,7 @@
"\n",
"smooth_node = pp.Node(gaussian_filter, data_node, sigma=slider_node)\n",
"\n",
"fig = pp.figure2d(smooth_node)"
"fig = pp.imagefigure(smooth_node)"
]
},
{
Expand Down Expand Up @@ -335,14 +335,14 @@
"\n",
"smooth_node = pp.Node(gaussian_filter, data_node, sigma=slider_node)\n",
"\n",
"fig2d = pp.figure2d(smooth_node)\n",
"fig2d = pp.imagefigure(smooth_node)\n",
"\n",
"# Sum the raw data along the vertical dimension\n",
"sum_raw = pp.Node(sc.sum, data_node, dim='y')\n",
"# Sum the smoothed data along the vertical dimension\n",
"sum_smoothed = pp.Node(sc.sum, smooth_node, dim='y')\n",
"# Give two nodes to a figure to display both on the same axes\n",
"fig1d = pp.figure1d(sum_raw, sum_smoothed)"
"fig1d = pp.linefigure(sum_raw, sum_smoothed)"
]
},
{
Expand Down Expand Up @@ -532,8 +532,8 @@
"id": "6e53a3c6-37eb-4a68-8431-50294dbb789d",
"metadata": {},
"source": [
"Finally, we add a 2D figure to the `hide_node`,\n",
"and a 1D figure after the slicing has been performed."
"Finally, we add an image figure to the `hide_node`,\n",
"and a line figure after the slicing has been performed."
]
},
{
Expand All @@ -543,8 +543,8 @@
"metadata": {},
"outputs": [],
"source": [
"fig2d = pp.figure2d(hide_node)\n",
"fig1d = pp.figure1d(slice_node)\n",
"fig2d = pp.imagefigure(hide_node)\n",
"fig1d = pp.linefigure(slice_node)\n",
"\n",
"pp.show_graph(masks_node)"
]
Expand Down
6 changes: 3 additions & 3 deletions docs/user-guide/customization/graph-node-tips.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
" coords={'time': sc.arange('time', 100.0, unit='s')},\n",
" )\n",
")\n",
"fig = pp.figure1d(a)\n",
"fig = pp.linefigure(a)\n",
"fig"
]
},
Expand All @@ -166,7 +166,7 @@
"\n",
"# Remove noise from signal\n",
"diff = a - b\n",
"pp.figure1d(diff)"
"pp.linefigure(diff)"
]
},
{
Expand All @@ -184,7 +184,7 @@
"\n",
"</div>\n",
"\n",
"All the examples for working with nodes and graphs presented so far have been using the lower-level `figure1d`, `figure2d` and `figure3d` as views for the data.\n",
"All the examples for working with nodes and graphs presented so far have been using the lower-level `linefigure`, `imagefigure` and `scatter3dfigure` as views for the data.\n",
"\n",
"These functions accept graph nodes as input, and provide visualizations for 1D, 2D or scatter 3D data.\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion src/plopp/plotting/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,5 +258,5 @@ def raise_multiple_inputs_for_2d_plot_error(origin):
'to create multiple figures, see the documentation on subplots at '
'https://scipp.github.io/plopp/customization/subplots.html. If you '
'want to plot two images onto the same axes, use the lower-level '
'plopp.figure2d function.'
'plopp.imagefigure function.'
)

0 comments on commit ed312e6

Please sign in to comment.