I hope I'm asking this question at the right place.
I have a for-loop, in that many figures are created. After the loop is finished I want to produce one more figure with three of those earlier created plots as suplots.
My code right now is like this:
import numpy as np
import matplotlib.pyplot as plt
def f(t):
return np.exp(-t)*np.cos(2*np.pi*t)+(t/10)**2.
t1=np.arange(0.0,5.0,0.1)
t2=np.arange(0.0,5.0,0.02)
for i in range(2):
fig= plt.figure(i)
ax1=fig.add_subplot(111)
plt.title('Jon Snow')
kraft_plot,=ax1.plot(t1,np.sin(t1),color='purple')
tyrion=ax1.axvline(2,color='darkgreen',ls='dashed')
ax1.set_ylabel('Kraft [N]',color='purple',fontweight='bold')
ax1.set_xlabel('Zeit [s]',fontweight='bold')
ax2=ax1.twinx()
strecke_plot,=ax2.plot(t2,t2/5,color='grey',label='Verlauf der Strecke')
ax2.set_ylabel('Strecke [mm]',color='grey',fontweight='bold')
ax1.legend((kraft_plot,tyrion,strecke_plot),('Jonny','Dwarf','andalltherest'),loc=2)
plt.show()
Can you help me? I it possible to save a whole figure/plot?
Cheers, Dalleaux.
Edit: It should look like this (the right part is what I want to achieve): The text in the right should be normal sclaed, obviously...
The Problem is, that i FIRST want to have the figures printet alone and then together (finally I want to save as pdf/png with three figures in it)