44

Seabornの関数lmplotは両対数スケールでプロットできますか? これは通常のスケールでの lmplot です

import numpy as np
import pandas as pd
import seaborn as sns
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}) 
sns.lmplot('x', 'y', df2)

sns.lmplot('x', 'y', df2)

4

3 に答える 3

6

最初に seaborn 関数を呼び出します。属性 ( matplotlib の 2-d numpy 配列)FacetGridを持つオブジェクトを返します。オブジェクトを取得し、それを への呼び出しに渡します。axesAxesAxesdf1.plot

import numpy as np
import pandas as pd
import seaborn as sns

x =  10**np.arange(1, 10)
y = 10**np.arange(1,10)*2
df1 = pd.DataFrame(data=y, index=x)
df2 = pd.DataFrame(data = {'x': x, 'y': y})

fgrid = sns.lmplot('x', 'y', df2)    
ax = fgrid.axes[0][0]
df1.plot(ax=ax)        

ax.set_xscale('log')
ax.set_yscale('log')
于 2014-05-28T15:57:12.930 に答える