Log-Log plot of pandas dataframe

pandas, python

Solution

When trying to create a log-log plot using the `pandas` plot function you must select `loglog=True` rather than `logx=True, logy=True` within your keyword-arguments.

import matplotlib.pyplot as plt 
import pandas as pd
import numpy as np

x = 10 ** np.arange(1, 10)
y = 10 ** np.arange(1, 10) * 2

df1 = pd.DataFrame(data=y, index=x)

df1.plot(loglog=True, legend=False)

plt.show()

Problem

I would like to make a log-log plot with pandas ``` import numpy as np import pandas as pd x = 10**arange(1, 10) y = 10** arange(1,10)*2 df1 = pd.DataFrame( data=y, index=x ) df2 = pd.DataFrame(data = {'x': x, 'y': y}) df1.plot(logy=True, logx=True) ``` How can I make the x-axis logarithmic?

Original source