Using the plot functionality in pandas dataframe I try to get a proper logarithmic x-axis: sample code:
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
fig,ax = plt.subplots()
df = pd.DataFrame({'Freq':[63,125,250,500],'A':[1,2,3,4]})
ax.set_xscale('log')
ax.set_xticks(df['Freq'])
ax.set_xticklabels(df['Freq'])
df.set_index('Freq').plot(ax=ax)
This does however just result in 2 sets of x-ticks.. on top of each other:
I have looked at this, changed the order of commands, but that does not change anything. Anyone any ideas....?
EDIT:
I have also tried the following
import pandas as pd
fig,ax = plt.subplots() df =
pd.DataFrame({'Freq':[63,125,250,500],'A':[1,2,3,4]})
df.plot(ax=ax,x='Freq',logx=True,xticks=df['Freq'])
with almost identical results.