-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplots.py
More file actions
27 lines (22 loc) · 787 Bytes
/
plots.py
File metadata and controls
27 lines (22 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import matplotlib.pyplot as plt
from draw_bounds import DrawBounds
"""
Prototype of new create_canvas:
def create_canvas(user adds existince plot, DrawBounds instance, other options):
af = DrawBounds(ax=users plotting space)
fig.canvas.mpl_connect('button_press_event', af)
set things from other options
plt.show()
"""
def create_canvas(xlim=[0, 1.], ylim=[0., 1.]):
fig, ax = plt.subplots()
af = DrawBounds(ax=ax)
ax.set_xlim(xlim[0], xlim[1])
ax.set_ylim(ylim[0], ylim[1])
fig.canvas.mpl_connect('button_press_event', af)
plt.show()
def create_canvas_2(fig, ax, xlim=[0, 1.], ylim=[0., 1.]):
af = DrawBounds(ax=ax)
ax.set_xlim(xlim[0], xlim[1])
ax.set_ylim(ylim[0], ylim[1])
fig.canvas.mpl_connect('button_press_event', af)