Pandas offers kind='kde'
when plotting. In my setting, I would prefer a kde density. The alternative kind='histogram'
offers the orientation option: orientation='horizontal'
, which is strictly necessary for what I am doing. Unfortunately, orientation
is not available for kde.
At least this is what I think that happens because I get a
in set_lineprops
raise TypeError('There is no line property "%s"' % key)
TypeError: There is no line property "orientation"
Is there any straight forward alternative for plotting kde horizontally as easily as it can be done for histogram?
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
plt.ion()
ser = pd.Series(np.random.random(1000))
ax1 = plt.subplot(2,2,1)
ser.plot(ax = ax1, kind = 'hist')
ax2 = plt.subplot(2,2,2)
ser.plot(ax = ax2, kind = 'kde')
ax3 = plt.subplot(2,2,3)
ser.plot(ax = ax3, kind = 'hist', orientation = 'horizontal')
# not working lines below
ax4 = plt.subplot(2,2,4)
ser.plot(ax = ax4, kind = 'kde', orientation = 'horizontal')