Guest User

Untitled

a guest
Oct 16th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. %matplotlib inline
  2. import numpy as np
  3. import matplotlib.pyplot as plt
  4. import pandas as pd
  5. df = pd.DataFrame([[1.0, 10.0, 13.0, 11.0, 0.3],
  6. [2.0, 20.0, 30.0, 32.0, 0.5],
  7. [3.0, 30.0, 45.0, 21.0, 0.7],
  8. [4.0, 15.0, 13.0, 11.0, 0.1]],
  9. index=['a', 'b', 'c', 'd'],
  10. columns=['col1','col2','col3','col4','col5'])
  11.  
  12. fig = plt.figure(figsize=(6,3), dpi=200)
  13. ax1 = fig.add_subplot(121)
  14. df.plot(x="col1",y=["col2","col3","col4"],
  15. color=["red","green","orange"], linewidth = 1.0,
  16. kind="line", linestyle='-',ax=ax1,
  17. yerr="col5",fmt="o", mfc="b", ms=2.0,
  18. elinewidth=1.0,ecolor='blue',capsize=2.0,)
  19.  
  20. ax2 = fig.add_subplot(122)
  21. CL1=df.loc[:,"col1"]
  22. CL2=df.loc[:,"col2"]
  23. CL3=df.loc[:,"col3"]
  24. CL4=df.loc[:,"col4"]
  25. CL5=df.loc[:,"col5"]
  26. ax2.plot(CL1,CL2,"red",lw = 1.0)
  27. ax2.plot(CL1,CL3,"green",lw = 1.0)
  28. ax2.plot(CL1,CL4,"orange",lw = 1.0)
  29. ax2.errorbar(CL1,CL2,yerr=CL5,xerr=None,fmt="o",ms=2.0, mfc="b",
  30. elinewidth=1.0, ecolor='blue',capsize=2.0)
  31. ax2.errorbar(CL1,CL3,yerr=CL5,xerr=None,fmt="o",ms=2.0, mfc="b",
  32. elinewidth=1.0, ecolor='blue',capsize=2.0)
  33. ax2.errorbar(CL1,CL4,yerr=CL5,xerr=None,fmt="o",ms=2.0, mfc="b",
  34. elinewidth=1.0, ecolor='blue',capsize=2.0)
  35.  
  36. ax2.legend(('CL2', 'CL3', 'CL4'))
  37. plt.tight_layout()
  38. plt.show()
  39.  
  40. ax2.plot(CL1, CL2, "red", lw=1.0, zoder=10)
  41. ax2.plot(CL1, CL3, "green", lw=1.0, zoder=10)
  42. ax2.plot(CL1, CL4, "orange", lw=1.0, zoder=10)
  43.  
  44. fig = plt.figure(figsize=(6,3), dpi=200)
  45.  
  46. color=["red","green","orange"]
  47. ax2 = fig.add_subplot(122)
  48. CL1=df.loc[:,"col1"]
  49. CL5=df.loc[:,"col5"]
  50. for i in range(3):
  51. ax2.plot(CL1, df.iloc[:,i+1],color[i], marker='o', markersize=2, lw=1.0, zorder=10)
  52. ax2.errorbar(CL1, df.iloc[:,i+1], yerr=CL5, xerr=None, fmt="o", ms=2.0,
  53. elinewidth=1.0, ecolor='blue', capsize=6.0)
  54. ax2.legend(('CL2', 'CL3', 'CL4'))
  55. plt.tight_layout()
  56. plt.show()
Add Comment
Please, Sign In to add comment