Skip to content

Commit 1fcb0b9

Browse files
committed
Update documentation to reflect repository name change and enhance usage examples for plotting functionality
1 parent 00a11d5 commit 1fcb0b9

3 files changed

Lines changed: 56 additions & 43 deletions

File tree

docs/api/figure.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Figure
2-
========
2+
======
33

4-
.. automodule:: viewer.figure
4+
.. automodule:: anyplotlib.figure
55
:members:
66
:undoc-members: False
77
:show-inheritance:

docs/getting_started.rst

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,55 @@ Installation
66

77
Clone the repository and install with ``uv`` (or pip)::
88

9-
git clone https://github.com/your-org/viewer.git
10-
cd viewer
9+
git clone https://github.com/your-org/anyplotlib.git
10+
cd anyplotlib
1111
uv sync # installs the project + all dependencies
1212

1313
Quick start
1414
-----------
1515

16-
1-D viewer
17-
~~~~~~~~~~
16+
1-D plot
17+
~~~~~~~~
1818

1919
.. code-block:: python
2020
2121
import numpy as np
22-
from viewer import Viewer1D
22+
import anyplotlib as vw
2323
2424
x = np.linspace(0, 4 * np.pi, 512)
2525
signal = np.sin(x)
2626
27-
v = Viewer1D(signal, x_axis=x, units="rad")
27+
fig, ax = vw.subplots(1, 1, figsize=(620, 320))
28+
v = ax.plot(signal, axes=[x], units="rad")
2829
v # display in a Jupyter cell
2930
30-
2-D viewer
31-
~~~~~~~~~~
31+
2-D image
32+
~~~~~~~~~
3233

3334
.. code-block:: python
3435
3536
import numpy as np
36-
from viewer import Viewer2D
37+
import anyplotlib as vw
3738
3839
data = np.random.default_rng(0).standard_normal((256, 256))
39-
v = Viewer2D(data, units="px")
40+
fig, ax = vw.subplots(1, 1, figsize=(500, 500))
41+
v = ax.imshow(data, units="px")
4042
v # display in a Jupyter cell
4143
42-
For more elaborate usage, see the :doc:`auto_examples/index` gallery or
43-
the :doc:`api/index`.
44+
Bar chart
45+
~~~~~~~~~
4446

47+
.. code-block:: python
48+
49+
import numpy as np
50+
import anyplotlib as vw
4551
52+
values = np.array([42, 55, 48, 63, 71, 68], dtype=float)
53+
months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"]
54+
55+
fig, ax = vw.subplots(1, 1, figsize=(560, 320))
56+
bar = ax.bar(values, x_labels=months, color="#4fc3f7", show_values=True)
57+
bar # display in a Jupyter cell
58+
59+
For more elaborate usage, see the :doc:`auto_examples/index` gallery or
60+
the :doc:`api/index`.

docs/index.rst

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,49 +15,47 @@ canvas renderer. The goal is to duplicate and extend the interactive plotting c
1515
although the scope is intentionally limited in the following ways:
1616

1717
1. This uses the object-oriented API of Matplotlib, not the stateful pyplot interface. This means there is
18-
no `plt.imshow` or `plt.plot` instead, you create a viewer object and call methods on it to add data
19-
and customize the plot. This is a deliberate choice to avoid the pitfalls of the stateful API.
18+
no ``plt.imshow`` or ``plt.plot`` — instead, you create a figure object and call methods on axes to add
19+
data and customize the plot. This is a deliberate choice to avoid the pitfalls of the stateful API.
2020

21-
python
22-
```
23-
import anyplotlib as apl
24-
import matplotlib.pyplot as plt
21+
.. code-block:: python
2522
26-
# matplotlib:
27-
fig, axs = plt.subplots(1,1)
28-
axs.imshow(...)
23+
import anyplotlib as apl
24+
import matplotlib.pyplot as plt
2925
30-
# anyplotlib equivalent:
31-
fig, axs = apl.subplots(1,1)
32-
axs.imshow(...)
33-
```
26+
# matplotlib:
27+
fig, axs = plt.subplots(1, 1)
28+
axs.imshow(...)
29+
30+
# anyplotlib equivalent:
31+
fig, axs = apl.subplots(1, 1)
32+
axs.imshow(...)
3433
3534
2. In matplotlib they use vector graphics (SVG) to render the plot, which is great for static images. It's especially
36-
great for making publication-quality figures. (If you haven't try inkscape + matplotlib SVG output,
37-
it's pretty amazing.) For interactivity, it can be slow. Anyplotlib uses a pure-JavaScript canvas renderer which is
38-
much faster for interactive applications, but the quality of the output is not as good as vector graphics. This is a
39-
trade-off that we are willing to make for the sake of interactivity.
35+
great for making publication-quality figures. (If you haven't tried inkscape + matplotlib SVG output,
36+
it's pretty amazing.) For interactivity, it can be slow. Anyplotlib uses a pure-JavaScript canvas renderer which is
37+
much faster for interactive applications, but the quality of the output is not as good as vector graphics. This is a
38+
trade-off that we are willing to make for the sake of interactivity.
4039

4140
3. Matplotlib supports a wide range of marker styles, line styles, and other plot elements. Anyplotlib focuses on a
42-
core set of features that are most commonly used in scientific plotting. This means that some of the more
43-
esoteric features of Matplotlib may not be available in Anyplotlib. In general we try to match the lower level
44-
`collections` API of Matplotlib.
41+
core set of features that are most commonly used in scientific plotting. This means that some of the more
42+
esoteric features of Matplotlib may not be available in Anyplotlib. In general we try to match the lower level
43+
``collections`` API of Matplotlib.
4544

4645
4. Each collection, plot, image is rendered as a single object on the canvas. This is highly performant and more
47-
importantly allows for blitting. This is one of the main reasons why the `ipympl` backend of Matplotlib is so slow.
46+
importantly allows for blitting. This is one of the main reasons why the ``ipympl`` backend of Matplotlib is so slow.
4847

49-
5. Finally `anyplotlib` uses `AnyWidget` as the underlying widget framework. This means that it can be used in any
50-
environment that supports `AnyWidget`, including Jupyter notebooks, JupyterLab, and PyCharm notebook preview. Under
51-
the hood, `AnyWidget` uses a pure-JavaScript implementation of the widget protocol, which allows for fast rendering
52-
and interactivity.
48+
5. Finally ``anyplotlib`` uses ``AnyWidget`` as the underlying widget framework. This means that it can be used in any
49+
environment that supports ``AnyWidget``, including Jupyter notebooks, JupyterLab, and PyCharm notebook preview. Under
50+
the hood, ``AnyWidget`` uses a pure-JavaScript implementation of the widget protocol, which allows for fast rendering
51+
and interactivity.
5352

5453
**Disclaimer**: This project is in the early stages of development. Additionally many of the
55-
javascript code was optimized using LLM's. That being said, the javascript/python code is fairly minimal,
54+
JavaScript code was optimised using LLMs. That being said, the JavaScript/Python code is fairly minimal
5655
and not too difficult to understand.
5756

58-
59-
**Disclaimer #2**: Mostly this project is to see __if__ something like this is possible, it remains to be
60-
seen if this can be developed into a full-fledged plotting library. The hope is that this can be.
57+
**Disclaimer #2**: Mostly this project is to see *if* something like this is possible; it remains to be
58+
seen if this can be developed into a full-fledged plotting library. The hope is that it can.
6159

6260
* :ref:`genindex`
6361
* :ref:`modindex`

0 commit comments

Comments
 (0)