Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c27f489

Browse filesBrowse files
authored
Basic axes (#551)
* add colorbar to hlut tool * pause_events contextmanager * cleanup * very basic stuff works * perspective projection implementation * Graphic.add_axes, refactor grids into an object instead of dict * update example * docstrings * type annotations * fixes for gridplots * bbox account for camera state * change method name * Ruler tick text mapping * update docs * docstring * update docs * set axes using scence bbox in Figure.show() for WgpuManualOffscreenCanvas so axes are somewhat sensible * update year * docs * update examples * PlotArea has background * fix linear selector for images * linear selector examples with axes stuff * comments * change title * docs conf.py * api docs * remove pause_events from graphics.__all__ * remove gpu.rst * accidentally removed gpu guide from docs * smaller heatmap * smaller heatmap * fix gc * hlut fixes * update example nbs * add new nb tests screenshots * add desktop test screenshots * better stuff * fix Subplot.get_rect() * Figure.show() works well for tests and docs gallery * fix axes * update examples * fix axes when non auto grid * desktop screenshots * add selector tools test screenshot * update nb test and screenshots * update doc * black * very basic stuff works * perspective projection implementation * Graphic.add_axes, refactor grids into an object instead of dict * update example * docstrings * add colorbar to hlut tool * pause_events contextmanager * cleanup * type annotations * fixes for gridplots * bbox account for camera state * change method name * Ruler tick text mapping * update docs * docstring * update docs * set axes using scence bbox in Figure.show() for WgpuManualOffscreenCanvas so axes are somewhat sensible * update year * docs * update examples * PlotArea has background * fix linear selector for images * linear selector examples with axes stuff * comments * change title * docs conf.py * api docs * remove pause_events from graphics.__all__ * remove gpu.rst * accidentally removed gpu guide from docs * smaller heatmap * smaller heatmap * fix gc * hlut fixes * update example nbs * add new nb tests screenshots * add desktop test screenshots * better stuff * fix Subplot.get_rect() * Figure.show() works well for tests and docs gallery * fix axes * update examples * fix axes when non auto grid * desktop screenshots * add selector tools test screenshot * update nb test and screenshots * update doc * black * add fastplotlib to intersphinx for examples links * don't test linear selector example because github action is being weird * set timeout of 10 mins for CI actions * remove selectors from testutils * try something * try anotehr thing * add back axes update using camera * try yet another thing * axes.update_using_camera in Figure.show() is fine, but is viewport.render blocking * see if we can move the render call to test_examples.py * wrong attr * should work on rtd and CI test examples screenshots * fix keyerror * diffs are a bit larger now because of axes, increase tolerance and remove linear selector from tests because the diff is very large * update tolerances for nb test * forgot to update some test screenshots
1 parent 23e8957 commit c27f489
Copy full SHA for c27f489

File tree

150 files changed

+1351
-451
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner

150 files changed

+1351
-451
lines changed

‎.github/workflows/ci.yml

Copy file name to clipboardExpand all lines: .github/workflows/ci.yml
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
docs-build:
1818
name: Docs
1919
runs-on: bigmem
20+
timeout-minutes: 10
2021
if: ${{ !github.event.pull_request.draft }}
2122
strategy:
2223
fail-fast: false
@@ -49,6 +50,7 @@ jobs:
4950
test-build-full:
5051
name: Test Linux, notebook + glfw
5152
runs-on: bigmem
53+
timeout-minutes: 10
5254
if: ${{ !github.event.pull_request.draft }}
5355
strategy:
5456
fail-fast: false
@@ -105,6 +107,7 @@ jobs:
105107
test-build-desktop:
106108
name: Test Linux, only glfw
107109
runs-on: bigmem
110+
timeout-minutes: 10
108111
if: ${{ !github.event.pull_request.draft }}
109112
strategy:
110113
fail-fast: false

‎.github/workflows/screenshots.yml

Copy file name to clipboardExpand all lines: .github/workflows/screenshots.yml
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
screenshots:
1515
name: Regenerate
1616
runs-on: bigmem
17+
timeout-minutes: 10
1718
if: ${{ !github.event.pull_request.draft }}
1819
steps:
1920
- name: Install git-lfs

‎docs/source/api/fastplotlib.rst

Copy file name to clipboard
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
fastplotlib
2+
***********
3+
4+
.. currentmodule:: fastplotlib
5+
6+
.. autofunction:: fastplotlib.pause_events
7+
8+
.. autofunction:: fastplotlib.enumerate_adapters
9+
10+
.. autofunction:: fastplotlib.select_adapter
11+
12+
.. autofunction:: fastplotlib.print_wgpu_report
13+
14+
.. autofunction:: fastplotlib.run

‎docs/source/api/gpu.rst

Copy file name to clipboardExpand all lines: docs/source/api/gpu.rst
-6Lines changed: 0 additions & 6 deletions
This file was deleted.

‎docs/source/api/graphics/ImageGraphic.rst

Copy file name to clipboardExpand all lines: docs/source/api/graphics/ImageGraphic.rst
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Properties
2020
.. autosummary::
2121
:toctree: ImageGraphic_api
2222

23+
ImageGraphic.axes
2324
ImageGraphic.block_events
2425
ImageGraphic.cmap
2526
ImageGraphic.cmap_interpolation
@@ -41,6 +42,7 @@ Methods
4142
.. autosummary::
4243
:toctree: ImageGraphic_api
4344

45+
ImageGraphic.add_axes
4446
ImageGraphic.add_event_handler
4547
ImageGraphic.add_linear_region_selector
4648
ImageGraphic.add_linear_selector

‎docs/source/api/graphics/LineCollection.rst

Copy file name to clipboardExpand all lines: docs/source/api/graphics/LineCollection.rst
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Properties
2020
.. autosummary::
2121
:toctree: LineCollection_api
2222

23+
LineCollection.axes
2324
LineCollection.block_events
2425
LineCollection.cmap
2526
LineCollection.colors
@@ -45,6 +46,7 @@ Methods
4546
.. autosummary::
4647
:toctree: LineCollection_api
4748

49+
LineCollection.add_axes
4850
LineCollection.add_event_handler
4951
LineCollection.add_graphic
5052
LineCollection.add_linear_region_selector

‎docs/source/api/graphics/LineGraphic.rst

Copy file name to clipboardExpand all lines: docs/source/api/graphics/LineGraphic.rst
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Properties
2020
.. autosummary::
2121
:toctree: LineGraphic_api
2222

23+
LineGraphic.axes
2324
LineGraphic.block_events
2425
LineGraphic.cmap
2526
LineGraphic.colors
@@ -39,6 +40,7 @@ Methods
3940
.. autosummary::
4041
:toctree: LineGraphic_api
4142

43+
LineGraphic.add_axes
4244
LineGraphic.add_event_handler
4345
LineGraphic.add_linear_region_selector
4446
LineGraphic.add_linear_selector

‎docs/source/api/graphics/LineStack.rst

Copy file name to clipboardExpand all lines: docs/source/api/graphics/LineStack.rst
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Properties
2020
.. autosummary::
2121
:toctree: LineStack_api
2222

23+
LineStack.axes
2324
LineStack.block_events
2425
LineStack.cmap
2526
LineStack.colors
@@ -45,6 +46,7 @@ Methods
4546
.. autosummary::
4647
:toctree: LineStack_api
4748

49+
LineStack.add_axes
4850
LineStack.add_event_handler
4951
LineStack.add_graphic
5052
LineStack.add_linear_region_selector

‎docs/source/api/graphics/ScatterGraphic.rst

Copy file name to clipboardExpand all lines: docs/source/api/graphics/ScatterGraphic.rst
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Properties
2020
.. autosummary::
2121
:toctree: ScatterGraphic_api
2222

23+
ScatterGraphic.axes
2324
ScatterGraphic.block_events
2425
ScatterGraphic.cmap
2526
ScatterGraphic.colors
@@ -39,6 +40,7 @@ Methods
3940
.. autosummary::
4041
:toctree: ScatterGraphic_api
4142

43+
ScatterGraphic.add_axes
4244
ScatterGraphic.add_event_handler
4345
ScatterGraphic.clear_event_handlers
4446
ScatterGraphic.remove_event_handler

‎docs/source/api/graphics/TextGraphic.rst

Copy file name to clipboardExpand all lines: docs/source/api/graphics/TextGraphic.rst
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Properties
2020
.. autosummary::
2121
:toctree: TextGraphic_api
2222

23+
TextGraphic.axes
2324
TextGraphic.block_events
2425
TextGraphic.deleted
2526
TextGraphic.event_handlers
@@ -40,6 +41,7 @@ Methods
4041
.. autosummary::
4142
:toctree: TextGraphic_api
4243

44+
TextGraphic.add_axes
4345
TextGraphic.add_event_handler
4446
TextGraphic.clear_event_handlers
4547
TextGraphic.remove_event_handler

‎docs/source/api/layouts/subplot.rst

Copy file name to clipboardExpand all lines: docs/source/api/layouts/subplot.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Properties
2020
.. autosummary::
2121
:toctree: Subplot_api
2222

23+
Subplot.axes
24+
Subplot.background_color
2325
Subplot.camera
2426
Subplot.canvas
2527
Subplot.controller
@@ -60,8 +62,6 @@ Methods
6062
Subplot.remove_animation
6163
Subplot.remove_graphic
6264
Subplot.render
63-
Subplot.set_axes_visibility
64-
Subplot.set_grid_visibility
6565
Subplot.set_title
6666
Subplot.set_viewport_rect
6767

‎docs/source/api/selectors/LinearRegionSelector.rst

Copy file name to clipboardExpand all lines: docs/source/api/selectors/LinearRegionSelector.rst
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Properties
2020
.. autosummary::
2121
:toctree: LinearRegionSelector_api
2222

23+
LinearRegionSelector.axes
2324
LinearRegionSelector.axis
2425
LinearRegionSelector.block_events
2526
LinearRegionSelector.deleted
@@ -39,6 +40,7 @@ Methods
3940
.. autosummary::
4041
:toctree: LinearRegionSelector_api
4142

43+
LinearRegionSelector.add_axes
4244
LinearRegionSelector.add_event_handler
4345
LinearRegionSelector.add_ipywidget_handler
4446
LinearRegionSelector.clear_event_handlers

‎docs/source/api/selectors/LinearSelector.rst

Copy file name to clipboardExpand all lines: docs/source/api/selectors/LinearSelector.rst
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Properties
2020
.. autosummary::
2121
:toctree: LinearSelector_api
2222

23+
LinearSelector.axes
2324
LinearSelector.axis
2425
LinearSelector.block_events
2526
LinearSelector.deleted
@@ -39,6 +40,7 @@ Methods
3940
.. autosummary::
4041
:toctree: LinearSelector_api
4142

43+
LinearSelector.add_axes
4244
LinearSelector.add_event_handler
4345
LinearSelector.add_ipywidget_handler
4446
LinearSelector.clear_event_handlers

‎docs/source/conf.py

Copy file name to clipboardExpand all lines: docs/source/conf.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
2626

2727
project = "fastplotlib"
28-
copyright = "2023, Kushal Kolar, Caitlin Lewis"
28+
copyright = "2024, Kushal Kolar, Caitlin Lewis"
2929
author = "Kushal Kolar, Caitlin Lewis"
3030
release = fastplotlib.__version__
3131

@@ -57,7 +57,8 @@
5757
"../../examples/desktop/line_collection",
5858
"../../examples/desktop/scatter",
5959
"../../examples/desktop/heatmap",
60-
"../../examples/desktop/misc"
60+
"../../examples/desktop/misc",
61+
"../../examples/desktop/selectors",
6162
]
6263
),
6364
"ignore_pattern": r'__init__\.py',
@@ -102,6 +103,7 @@
102103
"numpy": ("https://numpy.org/doc/stable/", None),
103104
"pygfx": ("https://pygfx.com/stable", None),
104105
"wgpu": ("https://wgpu-py.readthedocs.io/en/latest", None),
106+
"fastplotlib": ("https://fastplotlib.readthedocs.io/en/latest/", None),
105107
}
106108

107109
html_theme_options = {

‎docs/source/index.rst

Copy file name to clipboardExpand all lines: docs/source/index.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ Welcome to fastplotlib's documentation!
1111
.. toctree::
1212
:maxdepth: 1
1313
:caption: API
14-
14+
15+
fastplotlib <api/fastplotlib>
1516
Figure <api/layouts/figure>
1617
Subplot <api/layouts/subplot>
1718
Graphics <api/graphics/index>
1819
Graphic Features <api/graphic_features/index>
1920
Selectors <api/selectors/index>
2021
Widgets <api/widgets/index>
2122
Utils <api/utils>
22-
GPU <api/gpu>
2323

2424
.. toctree::
2525
:caption: Gallery

‎examples/desktop/gridplot/gridplot.py

Copy file name to clipboardExpand all lines: examples/desktop/gridplot/gridplot.py
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import fastplotlib as fpl
1212
import imageio.v3 as iio
1313

14-
figure = fpl.Figure(shape=(2, 2))
14+
figure = fpl.Figure(shape=(2, 2), size=(700, 560))
1515

1616
im = iio.imread("imageio:clock.png")
1717
im2 = iio.imread("imageio:astronaut.png")
@@ -25,10 +25,6 @@
2525

2626
figure.show()
2727

28-
figure.canvas.set_logical_size(700, 560)
29-
30-
for subplot in figure:
31-
subplot.auto_scale()
3228

3329
# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively
3430
# please see our docs for using fastplotlib interactively in ipython and jupyter

‎examples/desktop/gridplot/gridplot_non_square.py

Copy file name to clipboardExpand all lines: examples/desktop/gridplot/gridplot_non_square.py
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import fastplotlib as fpl
1212
import imageio.v3 as iio
1313

14-
figure = fpl.Figure(shape=(2, 2), controller_ids="sync")
14+
figure = fpl.Figure(shape=(2, 2), size=(700, 560))
1515

1616
im = iio.imread("imageio:clock.png")
1717
im2 = iio.imread("imageio:astronaut.png")
@@ -23,10 +23,6 @@
2323

2424
figure.show()
2525

26-
figure.canvas.set_logical_size(700, 560)
27-
28-
for subplot in figure:
29-
subplot.auto_scale()
3026

3127
# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively
3228
# please see our docs for using fastplotlib interactively in ipython and jupyter

‎examples/desktop/gridplot/multigraphic_gridplot.py

Copy file name to clipboardExpand all lines: examples/desktop/gridplot/multigraphic_gridplot.py
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
from itertools import product
1515

1616
# define figure
17-
figure = fpl.Figure(shape=(2, 2), names=[["image-overlay", "circles"], ["line-stack", "scatter"]])
17+
figure = fpl.Figure(
18+
shape=(2, 2),
19+
names=[["image-overlay", "circles"], ["line-stack", "scatter"]],
20+
size=(700, 560)
21+
)
1822

1923
img = iio.imread("imageio:coffee.png")
2024

@@ -106,8 +110,6 @@ def make_circle(center, radius: float, n_points: int = 75) -> np.ndarray:
106110

107111
figure.show()
108112

109-
figure.canvas.set_logical_size(700, 560)
110-
111113
# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively
112114
# please see our docs for using fastplotlib interactively in ipython and jupyter
113115
if __name__ == "__main__":

‎examples/desktop/heatmap/heatmap.py

Copy file name to clipboardExpand all lines: examples/desktop/heatmap/heatmap.py
+4-6Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,20 @@
1010
import fastplotlib as fpl
1111
import numpy as np
1212

13-
figure = fpl.Figure()
13+
figure = fpl.Figure(size=(700, 560))
1414

15-
xs = np.linspace(0, 1_000, 10_000, dtype=np.float32)
15+
xs = np.linspace(0, 1_000, 9_000, dtype=np.float32)
1616

1717
sine = np.sin(np.sqrt(xs))
1818

19-
data = np.vstack([sine * i for i in range(20_000)])
19+
data = np.vstack([sine * i for i in range(15_000)])
2020

2121
# plot the image data
2222
img = figure[0, 0].add_image(data=data, name="heatmap")
23+
del data
2324

2425
figure.show()
2526

26-
figure.canvas.set_logical_size(700, 560)
27-
28-
figure[0, 0].auto_scale()
2927

3028
# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively
3129
# please see our docs for using fastplotlib interactively in ipython and jupyter

‎examples/desktop/heatmap/heatmap_cmap.py

Copy file name to clipboardExpand all lines: examples/desktop/heatmap/heatmap_cmap.py
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import fastplotlib as fpl
1212
import numpy as np
1313

14-
figure = fpl.Figure()
14+
figure = fpl.Figure(size=(700, 560))
1515

1616
xs = np.linspace(0, 1_000, 10_000, dtype=np.float32)
1717

@@ -24,10 +24,6 @@
2424

2525
figure.show()
2626

27-
figure.canvas.set_logical_size(700, 560)
28-
29-
figure[0, 0].auto_scale()
30-
3127
img.cmap = "viridis"
3228

3329
# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively

‎examples/desktop/heatmap/heatmap_data.py

Copy file name to clipboardExpand all lines: examples/desktop/heatmap/heatmap_data.py
+1-4Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import fastplotlib as fpl
1111
import numpy as np
1212

13-
figure = fpl.Figure()
13+
figure = fpl.Figure(size=(700, 560))
1414

1515
xs = np.linspace(0, 1_000, 9_000, dtype=np.float32)
1616

@@ -23,9 +23,6 @@
2323

2424
figure.show()
2525

26-
figure.canvas.set_logical_size(700, 560)
27-
28-
figure[0, 0].auto_scale()
2926
cosine = np.cos(np.sqrt(xs)[:3000])
3027

3128
# change first 2,000 rows and 3,000 columns

‎examples/desktop/heatmap/heatmap_square.py

Copy file name to clipboardExpand all lines: examples/desktop/heatmap/heatmap_square.py
+1-4Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import numpy as np
1212

1313

14-
figure = fpl.Figure()
14+
figure = fpl.Figure(size=(700, 560))
1515

1616
xs = np.linspace(0, 1_000, 20_000, dtype=np.float32)
1717

@@ -25,9 +25,6 @@
2525
del data # data no longer needed after given to graphic
2626
figure.show()
2727

28-
figure.canvas.set_logical_size(1500, 1500)
29-
30-
figure[0, 0].auto_scale()
3128

3229
if __name__ == "__main__":
3330
print(__doc__)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.