Skip to content

Commit a69666c

Browse files
committed
Add show and savefig method to raster_plot.py and fix pyplot.axes(ax) deprecation warning by replacing to pyplot.sca(ax). There is also a pandas deprecation warning regarding read_table, which was un-deprecated in pandas 0.25.0 (pandas-dev/pandas#27102)
1 parent d713087 commit a69666c

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

pynest/nest/raster_plot.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
'from_device',
3131
'from_file',
3232
'from_file_numpy',
33-
'from_file_pandas'
33+
'from_file_pandas',
34+
'show',
35+
'savefig'
3436
]
3537

3638

@@ -209,6 +211,18 @@ def from_device(detec, **kwargs):
209211
record_to is set to either 'ascii' or 'memory'.")
210212

211213

214+
def show(*args, **kwargs):
215+
import matplotlib.pyplot as plt
216+
217+
plt.show(*args, **kwargs)
218+
219+
220+
def savefig(*args, **kwargs):
221+
import matplotlib.pyplot as plt
222+
223+
plt.savefig(*args, **kwargs)
224+
225+
212226
def _from_memory(detec):
213227
ev = detec.get("events")
214228
return ev["times"], ev["senders"]
@@ -285,7 +299,7 @@ def _make_plot(ts, ts1, node_ids, neurons, hist=True, hist_binwidth=5.0,
285299
plt.ylabel("Rate (Hz)")
286300
plt.xlabel(xlabel)
287301
plt.xlim(xlim)
288-
plt.axes(ax1)
302+
plt.sca(ax1)
289303
else:
290304
plotid = plt.plot(ts1, node_ids, color_marker)
291305
plt.xlabel(xlabel)

0 commit comments

Comments
 (0)