i have the following code:
distrobution.plot(x = ["Observed", "Modelled"], y = ["Amount (mm)"], kind = "scatter", ylabel="Rainfall (mm)", figsize=(8,4), title ="Daily Rainfall Distrobution")
for the following dataframe:
but am getting the error:
‘x and y must be the same size’
How are they not the same size?
>Solution :
You have to plot each series separately:
fig, ax = plt.subplots(figsize=(8, 4))
df.plot.scatter(x='Observed', y="Amount (mm)", color='blue', ax=ax, legend=True)
df.plot.scatter(x='Modelled', y="Amount (mm)", color='green', ax=ax, legend=True)
ax.set_ylabel('Rainfall (mm)')
ax.set_xlabel('Count')
ax.set_title('Daily Rainfall Distribution')
ax.legend(['Observed', 'Modelled'], loc='upper right')
plt.show()

