@@ -17,8 +17,17 @@ Installation
1717 Usage
1818^^^^^
1919
20+ - Left-click to place a point
21+ - Right click to remove the nearest point
22+ - Left click on legend to change classes
23+ - Get positions with ``.get_positions() ``
24+
2025.. code-block :: python
2126
27+ import numpy as np
28+ import matplotlib.pyplot as plt
29+ from mpl_point_clicker import clicker
30+
2231 fig, ax = plt.subplots(constrained_layout = True )
2332 image = np.random.rand(512 , 512 )
2433 ax.imshow(image, cmap = " gray" )
2837 markers = [" o" , " x" , " *" ]
2938 )
3039
31- You can then access the positions via ``klicker.get_positions ``.
40+
41+ You can also add scroll to zoom and middle-click and drag to pan with tools from
42+ `mpl-interactions <https://mpl-interactions.readthedocs.io/en/stable/examples/zoom-factory.html >`_
43+
44+ .. code-block :: python
45+
46+ from mpl_interactions import zoom_factory, panhandler
47+
48+ fig, ax = plt.subplots(constrained_layout = True )
49+ image = np.random.rand(512 , 512 )
50+ ax.imshow(image, cmap = " gray" )
51+
52+ # add zooming and middle click to pan
53+ zoom_factory(ax)
54+ ph = panhandler(fig, button = 2 )
55+
56+ klicker = clicker(
57+ ax,
58+ [" cell" , " pdms" , " media" ],
59+ markers = [" o" , " x" , " *" ]
60+ )
3261
3362
3463
0 commit comments