Hi! Below is a sample program. It demonstrates two bugs when plotting date/ time histograms.
1. When the y scale is made "log", the histogram points plot as lines, but when the y scale is not log, they histogram plots as bars. I do not think that the look of the bars should change depending on whether or not the Y scale is logarithmic. 2. When the "agg.pdf" is removed, specifying "log" for the yscale produces a TypeError on the mac (see below) I would really like to know how to plot a histogram with real bars ,rather than little lines. Thanks! import matplotlib matplotlib.use('agg.pdf') if __name__=="__main__": import datetime import numpy as np import matplotlib import matplotlib.pyplot as pyplot import matplotlib.dates as mdates import matplotlib.mlab as mlab dates_and_counts = [[datetime.datetime(90,i,1), i*10] for i in range(1,13)] dates, counts = zip(*dates_and_counts) years = mdates.YearLocator() # every year months = mdates.MonthLocator() # every month yearsFmt = mdates.DateFormatter('%Y') fig = pyplot.figure() ax = fig.add_subplot(111) ax.bar(dates,counts) ax.set_ylabel('file count') ax.set_xlabel('file modification time (mtime)') ax.set_yscale('log') ax.xaxis.set_major_locator(years) ax.xaxis.set_major_formatter(yearsFmt) datemin = datetime.date(min(dates).year, 1, 1) datemax = datetime.date(max(dates).year, 1, 1) ax.set_xlim(datemin, datemax) ax.set_ylim(0,max(counts)) # format the coords message box def price(x): return '$%1.2f'%x ax.format_xdata = mdates.DateFormatter('%Y-%m-%d') ax.format_ydata = price ax.grid(True) # rotates and right aligns the x labels, and moves the bottom of the # axes up to make room for them fig.autofmt_xdate() pyplot.savefig("hist.pdf",format='pdf') 12:12 PM m:~$ python f.py Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/matplotlib/figure.py", line 772, in draw for a in self.axes: a.draw(renderer) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/matplotlib/axes.py", line 1601, in draw a.draw(renderer) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/matplotlib/axis.py", line 710, in draw tick.draw(renderer) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/matplotlib/axis.py", line 193, in draw self.label1.draw(renderer) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/matplotlib/text.py", line 502, in draw ismath=ismath) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/matplotlib/backends/backend_macosx.py", line 120, in draw_text self._draw_mathtext(gc, x, y, s, prop, angle) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/matplotlib/backends/backend_macosx.py", line 112, in _draw_mathtext gc.draw_mathtext(x, y, angle, 255 - image.as_array()) TypeError: image has incorrect type (should be uint8) 12:12 PM m:~$ % V/r, Simson Garfinkel ------------------------------------------------------------------------------ Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users