matplotlib

Bar plots and legends in pylab/matplotlib

13 June, 2009 - 09:41

I like working with Matplotlib aka Pylab for my plotting needs in Python, but today I stumbled on a weird issue when creating a mixed bar + line plot with legend. Take the following snippet:

pylab.bar(x, yr, color='#88aa33', align='center', label='histogram')
pylab.plot(x, yc, 'bo-', label='cumulative')
pylab.legend()

This generates something like (note the entry overload in the legend):

Legend entry overload.

[Update: this issue seems to be solved. The issue described here occurred with Matplotlib version 0.91.2. With Matplotlib 0.99.0 I don't have this problem anymore.]

Read more...

Date tick control in pylab/matplotlib

18 May, 2009 - 14:05

Today I struggled a bit with pylab's plot_date function and overlapping date tick labels:

overlapping plot_date xticks

Read more...