Created
April 16, 2019 07:42
-
-
Save steven-mi/fc60dc329d2ec4d6db44532c209c3448 to your computer and use it in GitHub Desktop.
plotting a pyplot in a for loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
# plot 0 plot 1 plot 2 plot 3 | |
x=[[1,2,3,4],[1,4,3,4],[1,2,3,4],[9,8,7,4]] | |
y=[[3,2,3,4],[3,6,3,4],[6,7,8,9],[3,2,2,4]] | |
plots = zip(x,y) | |
figs={} | |
axs={} | |
for idx,plot in enumerate(plots): | |
figs[idx]=plt.figure() | |
axs[idx]=figs[idx].add_subplot(111) | |
axs[idx].plot(plot[0],plot[1]) | |
return figs, axs | |
figs, axs = loop_plot(plots) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment