python: scatter plot logarithmic scale
let matplotlib
take the log for you:
fig = plt.figure()ax = plt.gca()ax.scatter(data['o_value'] ,data['time_diff_day'] , c='blue', alpha=0.05, edgecolors='none')ax.set_yscale('log')ax.set_xscale('log')
If you are using all the same size and color markers, it is faster to use plot
fig = plt.figure()ax = plt.gca()ax.plot(data['o_value'] ,data['time_diff_day'], 'o', c='blue', alpha=0.05, markeredgecolor='none')ax.set_yscale('log')ax.set_xscale('log')
The accepted answer is a bit out of date. At least pandas 0.25 natively supports log axes:
# logarithmic Xdf.plot.scatter(..., logx=True)# logarithmic Ydf.plot.scatter(..., logy=True)# bothdf.plot.scatter(..., loglog=True)