This is a big release with a ton of new features!
New
- NDWidget: The biggest new addition, a system for viewing n-dimensional multi-modal datasets with arbitrary graphical representations. For more information see docs on the data model and a guide on how to use it. While this does talk about neuroscience datasets, it is applicable to any forms of scientific data that fit the data model (n-dim, multi modal, heterogeneous sampling, etc.). Big thanks to everyone who was involved in designing, brainstorming and reviewing the NDWidget! @clewis7 @apasarkar @FlynnOConnell
- New graphics:
MeshGraphic,SurfaceGraphic,PolygonGraphic,InfLineGraphic, andImageYUVGraphic(YUV components sent straight to the GPU, much faster for displaying video data, use withasyncvideo: https://pypi.org/project/asyncvideo/). - Collections refactor: new
ScatterCollection,ScatterStack,ImageCollectionandImageGrid. Numpy-like fancy indexing across graphics. - Lines and scatters:
dash_patternandthinargs, andcmap_range - Images: native dtypes are kept (only 64-bit types are cast to float32), new args: gamma, colorspace, cpu_buffer and texture_usage.
- Data setters: setting data with a different size or shape automaticlaly allocates a new buffer!
- Graphic: scale, map_model_to_world()/map_world_to_model(), tooltip_format.
- Selectors: the
HighlightSelectors,VisibilitySelector,ImageVisibilitySelector,SelectorCollection(LinearSelectors, RectangleSelectors, …) and SelectionVector. - Tools: a
Cursortool and a tooltips. - imgui: windows can go on any edge, float, or sit in the toolbar, for a figure or a single subplot (add_imgui_window). Each graphic can have its own right-click popup. ImguiColorbar replaces the HistogramLUTTool.
- Config system, see the docs.
- Other: Figure(rects=/extents=) accepts a dict keyed by subplot name; axis labels; PlotArea.x_range/y_range/map_world_to_screen(); matplotlib migration guide.
Breaking
- Dependencies: Python ≥ 3.11, numpy ≥ 2.1, pygfx == 0.17.0. imgui requires imgui-bundle<1.92.900 until the next wgpu-py release.
- isolated_buffer removed from every graphic; buffers always copy, some graphics such as
ImageGraphic, have acpu_bufferthat you can set to false for directly sending data to the GPU with no copy. - All uniform_* kwargs removed: uniform_color(s), uniform_marker, uniform_edge_color, uniform_size and point_rotation_mode are gone, and the mode is inferred from the passed or set value. A single color is now uniform, so line.colors returns a pygfx.Color and line.colors[i] = ... raises TypeError unless per-vertex colors were passed.
- Line/scatter cmap: returns a cmap.Colormap and is applied on the GPU. Use cmap_transform/cmap_range instead of graphic.cmap.transform.
- Image cmap: returns a
cmap.Colormapinstead of a str. - Collections:
collection[i]andcollection[slice]are removed; usecollection.graphics[i]or the accessors, e.g.collection.data[i]. kwargs_lines and uniform_colors are gone. - LineStack(separation=): was a float (default 10) added to each line's own max. It is now an (x, y, z) gap (default (0, 0, 0)) added to one step shared by all graphics (the max over all the data).
- Defaults: scatter sizes went from 1 to 5. Lines with thickness < 1.1 no longer switch to the thin material automatically, pass thin=True.
- Tooltips: now on by default in every subplot. Figure(show_tooltips=), figure.show_tooltips and figure.tooltip_manager are gone. Use subplot.tooltip.enabled and graphic.tooltip_format.
- imgui renames:
- add_gui()/guis → add_imgui_window()/imgui_windows
- register_popup/open_popup/Graphic.right_click_menu → set_imgui_right_click()
- ui.EdgeWindow/Window/Popup/BaseGUI/GUI_EDGES → ImguiWindow/ImguiPopup/ImguiBase/EDGES
- ColormapPicker removed
- HistogramLUTTool removed, replaced by ui.ImguiColorbar.
- ImageWidget is now a thin wrapper over NDWidget. ndim, n_scrollable_dims, n_img_dims and reset_vmin_vmax_frame() are gone, and window_funcs returns the plain {dim: (func, size)} dict.
- fpl.utils.get_nearest_graphics* → fpl.get_nearest_graphics*.
Fixed
- Newer images now layer above older ones (#944).
- LinearSelector/LinearRegionSelector no longer crash with parent=None (#945).
- Setting image/volume alpha now works; it used to write to a nonexistent material.alpha (#1074).
- LinearSelector.limits are no longer rounded to integers.
- Nested loops over a Figure or collection work; the loops used to share one iterator.
- PolygonSelector buffers now shrink as well as grow (#958).
- ImageWidget.set_data() accepts arrays whose slider dims have different lengths (#965).
- The coolwarm cmap ambiguity warning is gone (#1079).
What's Changed
- fix z layering for images by @kushalkolar in #944
- fix linear and linear region selectors offset when parent is None by @kushalkolar in #945
- Polygon buffer also shrinks when it can by @almarklein in #958
- Add support for mesh and surface by @almarklein in #953
- remove dim length checks in
iw.set_data()by @kushalkolar in #965 - center links and badges by @FlynnOConnell in #969
- cursor tool and better tooltips by @kushalkolar in #947
- Fixes bug where tooltip info is incorrectly retrieved when tooltip in… by @apasarkar in #986
- fix type annot by @kushalkolar in #987
- rename test that was never being run before by @kushalkolar in #988
- fix typos by @kushalkolar in #991
- make ndc pos tuple an array before adding by @kushalkolar in #992
- Small updates by @kushalkolar in #989
- setting initial scale was missing from
Graphic._set_world_objectby @kushalkolar in #993 - Adding top gui to fpl by @clewis7 in #999
- fix bug in layout setting by @clewis7 in #1001
- add AI statements by @clewis7 in #1007
- remove screenshot accidentally uploaded to repo by @clewis7 in #1008
- Update GOVERNANCE.md by @clewis7 in #1009
Figurecan acceptrectsorextentsas andictwith keys indicating subplot names by @kushalkolar in #1014- add partial camera linking example by @kushalkolar in #1020
- drop python 3.10 by @kushalkolar in #1062
- Edit contributing.md, add PR template by @kushalkolar in #1059
- Use namespaced "matplotlib:coolwarm" to silence cmap ambiguity warning by @hmaarrfk in #1079
- pin to newer pygfx by @kushalkolar in #1082
NDWidgetby @kushalkolar in #971- generate api docs during sphinx build by @kushalkolar in #1086
- Imgui legend by @kushalkolar in #1088
- Torch transpose by @kushalkolar in #1091
- ndwidget writeup by @kushalkolar in #1090
- Update _version.py by @kushalkolar in #1093
New Contributors
Full Changelog: v0.6.1...v0.7.0