-2

I have two python lists that looks like the following:

a = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
b = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]

How can I create a plot of these two lists (indices as x and values as y) that contains two subplots, each with its own title and axis labels?

Kaihua Hou
  • 310
  • 1
  • 2
  • 11

2 Answers2

0

Please try this code. It looks like you are trying to make two plots. You can do that with this code. import matplotlib.pyplot as plt import numpy as np

#plot 1:
x = np.array([0, 1, 2, 3])
y = np.array([3, 8, 1, 10])

plt.subplot(1, 2, 1)
plt.plot(x,y)

#plot 2:
x = np.array([0, 1, 2, 3])
y = np.array([10, 20, 30, 40])

plt.subplot(1, 2, 2)
plt.plot(x,y)

plt.show()

But you code has only two axis data. What do you want to do with this?

Sohan Arafat
  • 93
  • 2
  • 16
0
plt.subplot(1,2,1)
plt.plot(a)

plt.subplot(1,2,2)
plt.plot(b)

plt.show()
dekuShrub
  • 466
  • 4
  • 20