So I collected some data and I'd like to plot them and then save them. The problem is it won't work. When I execute the lines every command is executed by its own.
For example I'd like to make a Q-Q plot with a title and then save the plot as an image. For this example I just generated some random numbers.
import matplotlib.pyplot as plt
import scipy.stats as stats
import random
my_randoms = [random.randrange(1, 101, 1) for _ in range(100)]
stats.probplot(my_randoms, dist="norm", plot=plt)
plt.ylabel("Normal Q-Q plot")
plt.rcParams['figure.figsize'] = [12, 8]
plt.show()
plt.savefig("example")
The Problem is it doesn't work. When I execute the code I can see the plot but with out the title. When I execute the nex line I just see the blank plot but this time with the title and when I execute the plt.show() nothing happens.
So my question is how can I fix this. I'd like to give all my plots in my script titles and save them seperatly.
Best Regards!