Hello,
I am new here
I want to create a figure with two subplots where I plot my measurement results. I would like to create a function where I can recall the figure and put additional x and y data in the already existing subplots
It should somehow look like this:
def plot_results(v, c, name):
-
fig, (ax1, ax2) = plt.subplots(nrows=2, ncols=1, sharex=True)*
-
ax1.plot(v, c, label=name)*
-
ax1.legend()*
-
ax1.set_title(βC-Vβ)*
-
ax1.set_ylabel(βC in [F]β)*
-
ax2.plot(v, 1 / c, label=name)*
-
ax2.legend()*
-
ax2.set_title(β1/Cβ)*
-
ax2.set_xlabel(βV_{applied} in [V]β)*
-
ax2.set_ylabel(β1/C in [1/F]β)*
Then I would like to use the function plot_results like this
plot_results(v_1, c_1, β1st runβ)
plot_results(v_2, c_2, β2nd runβ)
But when I run the code, I get two windows with the window titles fig1 and fig2 where the data of the first measurement is in fig1 and the 2nd measurement in fig2, but i would love to have them in the same fig. Is there a way to recall the same fig again and again?
I would be very thankful if someone could help me with this