How do I plot list of tuples in Python?

后端 未结 5 937
自闭症患者
自闭症患者 2020-12-04 11:03

I have the following data set. I would like to use Python or Gnuplot to plot the data. The tuples are of the form (x, y). The Y-axis should be a log axis, th

5条回答
  •  死守一世寂寞
    2020-12-04 11:37

    You could also use zip

    import matplotlib.pyplot as plt
    
    l = [(0, 6.0705199999997801e-08), (1, 2.1015700100300739e-08),
         (2, 7.6280656623374823e-09), (3, 5.7348209304555086e-09),
         (4, 3.6812203579604238e-09), (5, 4.1572516753310418e-09)]
    
    x, y = zip(*l)
    
    plt.plot(x, y)
    

提交回复
热议问题