I am trying to achieve differentiation by hatch pattern instead of by (just) colour. How do I do it using pandas?
It's possible in matplotlib, by passing the hatch
optional argument as discussed here. I know I can also pass that option to a pandas plot
, but I don't know how to tell it to use a different hatch pattern for each DataFrame
column.
df = pd.DataFrame(rand(10, 4), columns=['a', 'b', 'c', 'd'])
df.plot(kind='bar', hatch='/');
For colours, there is the colormap
option described here. Is there something similar for hatching? Or can I maybe set it manually by modifying the Axes
object returned by plot
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…