Python Forum
Multiple plots with matplotlib - looping
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiple plots with matplotlib - looping
#4
JC,

To show the plots at the same time on different graphs you'd have to make the plt.show() call outside the for loop:



for i in plot_list:
    plt.figure()
    plt.plot(i)
plt.show
And if you want to show every plot from the list on the same graph you need to get rid of the plt.figure() call

for i in plot_list:
    plt.plot(i)
plt.show
PS: I changed your code a bit, that way of looping thru a list is more pythonic than doing it with i in range(len(plot_list))
Reply


Messages In This Thread
RE: Multiple plots with matplotlib - looping - by Crimson King - Sep-21-2016, 09:11 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Multiple Plots in Spyder PythonAndMe2023 0 920 Feb-03-2023, 07:00 PM
Last Post: PythonAndMe2023
  Trying to loop through code to plot seaborn line plots across multiple subplots eyavuz21 0 1,739 Dec-05-2022, 10:46 AM
Last Post: eyavuz21
  Multiple user defined plots with secondary axes using for loop maltp 1 1,526 Apr-30-2022, 10:19 AM
Last Post: maltp
  Matplotlib multiple set_over / under G_rizzle 0 1,113 Feb-14-2022, 12:13 PM
Last Post: G_rizzle
  Matplotlib - close multple plots with user input Positron79 0 1,790 Dec-01-2021, 05:26 PM
Last Post: Positron79
  Subplot - Plotting 4 plots on the same row Menthix 1 1,468 Nov-07-2021, 09:03 PM
Last Post: deanhystad
  Matplotlib: How do I convert Dates from Excel to use in Matplotlib JaneTan 1 3,298 Mar-11-2021, 10:52 AM
Last Post: buran
  Sharing X Axis in Sub plots JoeDainton123 1 2,216 Aug-22-2020, 04:11 AM
Last Post: deanhystad
  Help With Sub Plots JoeDainton123 0 1,725 Aug-20-2020, 10:48 PM
Last Post: JoeDainton123
  Group scatter plots Mekala 0 1,686 Jul-23-2020, 02:18 PM
Last Post: Mekala

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020