0

I am trying to plot the two line graphs on the same figure but the graphs are printed separately. I filtered the data and made two line graphs . How to merge both graphs on same figure?

code:

#getting columns with Primary type and arrest type

arrFalse=arrPri.loc[(arrPri["Primary Type"]== "ARSON") & (arrPri.Arrest == False),["count","Year"]]
arrTrue=arrPri.loc[(arrPri["Primary Type"]== "ARSON") & (arrPri.Arrest == True),["count","Year"]]

#plotting the graphs
arrFalse.plot(x="Year",y="count",kind="line",figsize=(10,5),color="red")
arrTrue.plot(x="Year",y="count",kind="line",figsize=(10,5),color="olive",linestyle="dashed")
plt.xlabel(uPri[i])
plt.legend(crimes.Arrest)
plt.title(uPri[i] + " Vs Crime count")
plt.show()

`

Community
  • 1
  • 1
Panther
  • 103
  • 6
  • 1
    This is not a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve), but the [pandas documentation](https://pandas.pydata.org/pandas-docs/stable/visualization.html) is quite extensive and should tell you what to do. If I had to guess, you should do sth like `plt.plot(arrFalse["Year"], arrFalse["count"])`. – Mr. T Jul 22 '18 at 16:21
  • It is simple I am getting two plots and I just want to get one plot containing both line charts. – Panther Jul 22 '18 at 16:56
  • And I suggested a simple way to achieve this. If it will work, may depend on your data structure, which you did not make public. – Mr. T Jul 22 '18 at 16:56
  • Got it thanks for the ans. – Panther Jul 22 '18 at 16:59

0 Answers0