Issue
I would like to get different plot, but getting one figure with everything plots. Why? For example I have two script for two plot, but python merge them in one image.
import matplotlib.pyplot as plt
#% matplotlib inline
import seaborn as sns
# Use plot styling from seaborn.
sns.set(style='darkgrid')
# Increase the plot size and font size.
sns.set(font_scale=1.5)
plt.rcParams["figure.figsize"] = (12,6)
# Plot the learning curve.
plt.plot(df_stats['Training Loss'], 'b-o', label="Training")
plt.plot(df_stats['Valid. Loss'], 'g-o', label="Validation")
# Label the plot.
plt.title("Training & Validation Loss")
plt.xlabel("Epoch")
plt.ylabel("Loss")
plt.legend()
plt.xticks([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])
plt.show()
# Plot the learning curve.
plt.plot(df_stats['Train acc'], 'b-o', label="Training")
plt.plot(df_stats['Valid. Accur'], 'g-o', label="Validation")
# Label the plot.
plt.title("Training & Validation Loss")
plt.xlabel("Epoch")
plt.ylabel("accuracy")
plt.legend()
plt.xticks([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])
plt.show()
How can I do?
Solution
Everytime you want to create a new plot, you have to write a plt.figure()
.
It will open a new empty plot that you'll be able to open with several others.
Answered By - Pianissimo
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.