Skip to content

Commit eb72c3e

Browse files
authored
Update guide.rst
1 parent 6627b0b commit eb72c3e

1 file changed

Lines changed: 48 additions & 13 deletions

File tree

docs/source/user_guide/guide.rst

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ What is `fastplotlib`?
2121
----------------------
2222

2323
`fastplotlib` is a cutting-edge plotting library built using the `pygfx <https://github.com/pygfx/pygfx>`_ rendering engine.
24-
The lower level details of the rendering process (i.e. defining a scene, camera, renderer, etc.) are abstracted away, allowing users to focus on their data.
24+
The lower-level details of the rendering process (i.e. defining a scene, camera, renderer, etc.) are abstracted away, allowing users to focus on their data.
2525
The fundamental goal of `fastplotlib` is to provide a high-level, expressive API that promotes large-scale explorative scientific visualization.
2626

2727

@@ -47,7 +47,7 @@ Before giving a detailed overview of the library, here is a minimal example::
4747
.. image:: /_static/guide_hello_world.png
4848

4949

50-
This was a simple example of how the `fastplotlib` API works to create a plot, add some data to the plot, and then visualize it.
50+
This is just a simple example of how the `fastplotlib` API works to create a plot, add some image data to the plot, and then visualize it.
5151
However, this is just scratching the surface of what we can do with `fastplotlib`.
5252
Next, we will take a look at the building blocks of `fastplotlib` and how they can be used to create more complex visualizations.
5353

@@ -56,30 +56,43 @@ Next, we will take a look at the building blocks of `fastplotlib` and how they c
5656
The base of any visualization in `fastplotlib` is a `Figure` object. This can be a singular plot or a grid of subplots.
5757
The `Figure` object houses and takes care of the underlying rendering components such as the camera, controller, renderer, and canvas.
5858

59-
Initially, our figure is empty as we have not added any `Graphics`. After defining a `Figure`, we can begin to add `Graphic` objects.
59+
After defining a `Figure`, we can begin to add `Graphic` objects.
6060

6161
**Graphics**
6262

63-
A `Graphic` can be an image, a line, a scatter, a collection of lines, and more. Graphics have what we like to call `GraphicFeatures` which
64-
are mutable, indexable properties that can be linked to events.
63+
A `Graphic` can be an image, a line, a scatter, a collection of lines, and more. All graphics can be given a string name. This allows graphics
64+
to be easily accessed from figures::
6565

66-
(1) Common `GraphicFeatures`
66+
fig = fpl.Figure()
67+
68+
data = np.random.rand(512, 512)
69+
70+
image_graphic = fig[0,0].add_image(data=data, name="random-img")
71+
72+
fig.show()
73+
74+
fig[0,0]["random-img"]
75+
..
76+
77+
Graphics also have mutable, indexable properties that can be linked to events.
78+
79+
(1) Common properties
6780

6881
+--------------+--------------------------------------------------------------------------------------------------------------+
6982
| Feature Name | Description |
7083
+==============+==============================================================================================================+
71-
| Name | Graphic name |
84+
| name | Graphic name |
7285
+--------------+--------------------------------------------------------------------------------------------------------------+
73-
| Offset | Offset position of the graphic, [x, y, z] |
86+
| offset | Offset position of the graphic, [x, y, z] |
7487
+--------------+--------------------------------------------------------------------------------------------------------------+
75-
| Rotation | Graphic rotation quaternion |
88+
| rotation | Graphic rotation quaternion |
7689
+--------------+--------------------------------------------------------------------------------------------------------------+
77-
| Visible | Access or change the visibility |
90+
| visible | Access or change the visibility |
7891
+--------------+--------------------------------------------------------------------------------------------------------------+
79-
| Deleted | Used when a graphic is deleted, triggers events that can be useful to indicate this graphic has been deleted |
92+
| deleted | Used when a graphic is deleted, triggers events that can be useful to indicate this graphic has been deleted |
8093
+--------------+--------------------------------------------------------------------------------------------------------------+
8194

82-
(2) Graphic-Specific `GraphicFeatures`
95+
(2) Graphic-Specific properties
8396

8497
(a) `ImageGraphic`
8598

@@ -153,11 +166,33 @@ Using our example from above: once we add a `Graphic` to the figure, we can then
153166
.. image:: /_static/guide_image_slice.png
154167

155168
Now that we have the basics of creating a `Figure`, adding `Graphics` to the `Figure`, and working with `GraphicFeatures` to change or alter a `Graphic`.
156-
Let's take a look at how we can define events to like `Graphics` and their `GraphicFeatures` together.
169+
Let's take a look at how we can define events to link `Graphics` and their properties together.
157170

158171
Events
159172
------
160173

174+
All events inherit from the `pygfx.Event` class (add link)
175+
176+
events table:
177+
178+
PYGFX_EVENTS = [
179+
"key_down",
180+
"key_up",
181+
"pointer_down",
182+
"pointer_move",
183+
"pointer_up",
184+
"pointer_enter",
185+
"pointer_leave",
186+
"click",
187+
"double_click",
188+
"wheel",
189+
"close",
190+
"resize",
191+
]
192+
193+
adding events (2 methods)
194+
195+
attributes of all events (table)
161196

162197
Selectors
163198
---------

0 commit comments

Comments
 (0)