Skip to content

Commit

Permalink
fix MatplotlibDeprecationWarning: use pyplot.sca(ax) instead of pyplo…
Browse files Browse the repository at this point in the history
…t.axes(ax)
  • Loading branch information
giaccone committed Mar 14, 2018
1 parent 37098cc commit b307fdb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions netlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,7 @@ def plot(self, to_file=False, filename=None, dpi_value=150):
v = self.get_voltage(variable)

if makesubplot:
plt.axes(axs[0])
plt.sca(axs[0])
plt.plot(self.t, v, label=legend_entries[k])


Expand All @@ -1405,19 +1405,19 @@ def plot(self, to_file=False, filename=None, dpi_value=150):
i = self.get_current(variable)

if makesubplot:
plt.axes(axs[1])
plt.sca(axs[1])
plt.plot(self.t, i, label=legend_entries[k])



if makesubplot:
plt.axes(axs[0])
plt.sca(axs[0])
plt.ylabel('voltage (V)', fontsize=16)
plt.grid()
plt.legend()
plt.tight_layout()

plt.axes(axs[1])
plt.sca(axs[1])
plt.xlabel('time (s)', fontsize=16)
plt.ylabel('current (A)', fontsize=16)
plt.grid()
Expand Down Expand Up @@ -1480,7 +1480,7 @@ def bode(self, decibel=False, to_file=False, filename=None, dpi_value=150):
# plot
import matplotlib.pyplot as plt
fig, axs = plt.subplots(2, 1)
plt.axes(axs[0])
plt.sca(axs[0])
plt.title('tf: ' + tf[0] + '/' + tf[1], fontsize=14)
if decibel:
plt.semilogx(self.f, 20 * np.log10(np.abs(H)))
Expand All @@ -1490,7 +1490,7 @@ def bode(self, decibel=False, to_file=False, filename=None, dpi_value=150):
plt.ylabel('magnitude', fontsize=14)
plt.grid()

plt.axes(axs[1])
plt.sca(axs[1])
plt.semilogx(self.f, np.angle(H) * 180 / np.pi)
plt.xlabel('frequency (Hz)', fontsize=14)
plt.ylabel('phase (deg)', fontsize=14)
Expand Down

0 comments on commit b307fdb

Please sign in to comment.