Commit 0f1ee8fa authored by O'Reilly Media, Inc.'s avatar O'Reilly Media, Inc.
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading
+1716 −0

File added.

Preview size limit exceeded, changes collapsed.

+13 −0
Changes for Interactive Applications Using Matplotlib_Code/8846OS_01_Code/basic_mpl_connect.py: 13 added lines, 0 removed lines.
Original line number Diff line number Diff line
from __future__ import print_function
import matplotlib.pyplot as plt

def process_key(event):
    print("Key:", event.key)

def process_button(event):
    print("Button:", event.x, event.y, event.xdata, event.ydata, event.button)

fig, ax = plt.subplots(1, 1)
fig.canvas.mpl_connect('key_press_event', process_key)
fig.canvas.mpl_connect('button_press_event', process_button)
plt.show()
+10 −0
Changes for Interactive Applications Using Matplotlib_Code/8846OS_01_Code/disable_mpl_keymap.py: 10 added lines, 0 removed lines.
Original line number Diff line number Diff line
from __future__ import print_function
import matplotlib.pyplot as plt

def process_key(event):
    print(event.key)

fig, ax = plt.subplots(1, 1)
fig.canvas.mpl_connect('key_press_event', process_key)
fig.canvas.mpl_disconnect(fig.canvas.manager.key_press_handler_id)
plt.show()
+13 −0
Changes for Interactive Applications Using Matplotlib_Code/8846OS_01_Code/linecoll_track_viewer.py: 13 added lines, 0 removed lines.
Original line number Diff line number Diff line
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
from tutorial import track_loader

tracks = track_loader('polygons.shp')
# Filter out non-tracks (unassociated polygons given trackID of -9)
tracks = {tid: t for tid, t in tracks.items() if tid != -9}

fig, ax = plt.subplots(1, 1)
lc = LineCollection(tracks.values(), color='b')
ax.add_collection(lc)
ax.autoscale(True)
plt.show()
Loading