0

Note : this is not bar chat it is scatter char, some solutions are given here but they do not work, I have categories on one axis

ax=df_a.plot(y='y', x='x' , kind='scatter',  color='#FF7F50', figsize=(7,4), label='a')
df_b.plot(y='y', x='x'  , kind='scatter',ax=ax, label='b' )
#plt.legend(loc='upper left');
plt.show()

![enter image description here

I want to have separate blue and orange line for each category like in multiple barcharts like this

Reproducible example

    data  = [['tom', 10], ['tom', 15], ['juli', 14],['juli', 16],['tom', 30] ]
    data1 = [['tom', 15], ['tom', 34], ['juli', 25],['juli', 15],['juli', 19] ]

    df1= pd.DataFrame(data, columns = ['month', 'val'])
    df2= pd.DataFrame(data1, columns = ['month', 'val'])
    ax =plt.figure(figsize=(14,10))
    
    
    ax=df1.plot(y='month', x='val' , kind='scatter', color='#FF7F50', figsize=(12,6), label='df1')
    df2.plot(y='month', x='val'  , kind='scatter', ax=ax, label='df2' )
alex3465
  • 409
  • 4
  • 18
  • Plots usually represent the data. What about the data you have? Have you checked it thoroughly? Have you clearly set which variable to be represented by which axis, in this case Y-axis and X-axis? – Dhana D. Apr 01 '22 at 11:04
  • y= chategories, x= numerical values, df_a and df_b have common categories and some available in only either – alex3465 Apr 01 '22 at 11:08
  • Does this answer your question? [Plot two pandas dataframes in one scatter plot](https://stackoverflow.com/questions/54344222/plot-two-pandas-dataframes-in-one-scatter-plot) – Dhana D. Apr 01 '22 at 11:13

0 Answers0