Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %matplotlib inline
- import numpy as np
- import matplotlib.pyplot as plt
- import pandas as pd
- df = pd.DataFrame([[1.0, 10.0, 13.0, 11.0, 0.3],
- [2.0, 20.0, 30.0, 32.0, 0.5],
- [3.0, 30.0, 45.0, 21.0, 0.7],
- [4.0, 15.0, 13.0, 11.0, 0.1]],
- index=['a', 'b', 'c', 'd'],
- columns=['col1','col2','col3','col4','col5'])
- fig = plt.figure(figsize=(6,3), dpi=200)
- ax1 = fig.add_subplot(121)
- df.plot(x="col1",y=["col2","col3","col4"],
- color=["red","green","orange"], linewidth = 1.0,
- kind="line", linestyle='-',ax=ax1,
- yerr="col5",fmt="o", mfc="b", ms=2.0,
- elinewidth=1.0,ecolor='blue',capsize=2.0,)
- ax2 = fig.add_subplot(122)
- CL1=df.loc[:,"col1"]
- CL2=df.loc[:,"col2"]
- CL3=df.loc[:,"col3"]
- CL4=df.loc[:,"col4"]
- CL5=df.loc[:,"col5"]
- ax2.plot(CL1,CL2,"red",lw = 1.0)
- ax2.plot(CL1,CL3,"green",lw = 1.0)
- ax2.plot(CL1,CL4,"orange",lw = 1.0)
- ax2.errorbar(CL1,CL2,yerr=CL5,xerr=None,fmt="o",ms=2.0, mfc="b",
- elinewidth=1.0, ecolor='blue',capsize=2.0)
- ax2.errorbar(CL1,CL3,yerr=CL5,xerr=None,fmt="o",ms=2.0, mfc="b",
- elinewidth=1.0, ecolor='blue',capsize=2.0)
- ax2.errorbar(CL1,CL4,yerr=CL5,xerr=None,fmt="o",ms=2.0, mfc="b",
- elinewidth=1.0, ecolor='blue',capsize=2.0)
- ax2.legend(('CL2', 'CL3', 'CL4'))
- plt.tight_layout()
- plt.show()
- ax2.plot(CL1, CL2, "red", lw=1.0, zoder=10)
- ax2.plot(CL1, CL3, "green", lw=1.0, zoder=10)
- ax2.plot(CL1, CL4, "orange", lw=1.0, zoder=10)
- fig = plt.figure(figsize=(6,3), dpi=200)
- color=["red","green","orange"]
- ax2 = fig.add_subplot(122)
- CL1=df.loc[:,"col1"]
- CL5=df.loc[:,"col5"]
- for i in range(3):
- ax2.plot(CL1, df.iloc[:,i+1],color[i], marker='o', markersize=2, lw=1.0, zorder=10)
- ax2.errorbar(CL1, df.iloc[:,i+1], yerr=CL5, xerr=None, fmt="o", ms=2.0,
- elinewidth=1.0, ecolor='blue', capsize=6.0)
- ax2.legend(('CL2', 'CL3', 'CL4'))
- plt.tight_layout()
- plt.show()
Add Comment
Please, Sign In to add comment