Reputation: 567
I want to produce scatter plots of data from a pandas df, sample below. I can produce line plots with:
ax = df_stats.plot(x = 't', y = 't_TI_var_ws')
ax1 = ax.twinx()
df_stats.plot(x='t',y='t_TI_var_pwr',ax=ax1, color='g')
but when I try to use .scatter
to plot the same data as a scatter plot I get the error KeyError: 't'
ax = df_stats.plot.scatter(x = 't', y = 't_TI_var_ws')
ax1 = ax.twinx()
df_stats.plot.scatter(x='t',y='t_TI_var_pwr',ax=ax1, color='g')
Upvotes: 1
Views: 55
Reputation: 392
It seems that your column to is a timestamp. To use scatter it must be a float. You can plot scatter plot with:
ax = df_stats.plot(x = 't', y='t_TI_var_pwr',style='o')
Upvotes: 1