Home > Mobile >  how to draw add_line from matplotlib to subplot
how to draw add_line from matplotlib to subplot

Time:01-11

enter image description here

the matplotlib subplot doesn't show any graph while trying to add_line with my data.

fig, (ax1, ax2) = plt.subplots(1, 2)

for csv in tqdm(csv_files):
    temp_csv = pd.read_csv(csv)[csv_features]
    plt.sca(ax1)
    plt.gca().add_line(plt.Line2D(range(262), temp_csv["내부 온도 1 최저"][:262], color=color[risk]))
    plt.sca(ax2)
    plt.gca().add_line(plt.Line2D(range(262), temp_csv["내부 온도 1 최저"][:262], color=color[risk]))

I want to make the upper codes work.

CodePudding user response:

You seem to be jumping through hoops here. Does

fig, (ax1, ax2) = plt.subplots(1, 2)
ax1.plot(range(262), x[:262], color=color[risk])
ax2.plot(range(262), y[:262], color=color[risk])

(where x and y are replaced by whatever you want to plot) not work for you?

  •  Tags:  
  • Related