Given the following matplotlib program:

##
import numpy as np
import matplotlib.pyplot as plt

x = np.arange(3)
width = 0.35
hdfs = (292.97, 304.49, 305.47)
bfs = (614.57, 706.02, 847.44)

plt.subplot(111)
hdfs_rects = plt.bar(x, hdfs, width, color='b')
bfs_rects = plt.bar(x + width, bfs, width, color='g', hatch='/')

plt.xticks(x + width, ('100 ls ops', '100 touch ops', '100 0k copy ops'))
plt.ylabel('Time (sec)')
plt.title('Metadata Performance')
plt.legend((hdfs_rects[0], bfs_rects[0]), ('HDFS', 'BoomFS'), loc='upper right')
plt.ylim([0, 1200])
plt.savefig('metadata_throughput.pdf')
##

I see the following error using matplotlib 0.95.1:

Traceback (most recent call last):
  File "metadata_throughput.py", line 21, in <module>
    plt.savefig('metadata_throughput.pdf')
  File "/opt/local/lib/python2.5/site-packages/matplotlib/pyplot.py",
line 345, in savefig
    return fig.savefig(*args, **kwargs)
  File "/opt/local/lib/python2.5/site-packages/matplotlib/figure.py",
line 990, in savefig
    self.canvas.print_figure(*args, **kwargs)
  File "/opt/local/lib/python2.5/site-packages/matplotlib/backend_bases.py",
line 1419, in print_figure
    **kwargs)
  File "/opt/local/lib/python2.5/site-packages/matplotlib/backend_bases.py",
line 1313, in print_pdf
    return pdf.print_pdf(*args, **kwargs)
  File 
"/opt/local/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py",
line 1883, in print_pdf
    self.figure.draw(renderer)
  File "/opt/local/lib/python2.5/site-packages/matplotlib/figure.py",
line 772, in draw
    for a in self.axes: a.draw(renderer)
  File "/opt/local/lib/python2.5/site-packages/matplotlib/axes.py",
line 1601, in draw
    a.draw(renderer)
  File "/opt/local/lib/python2.5/site-packages/matplotlib/patches.py",
line 301, in draw
    renderer.draw_path(gc, tpath, affine, rgbFace)
  File 
"/opt/local/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py",
line 1248, in draw_path
    self.check_gc(gc, rgbFace)
  File 
"/opt/local/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py",
line 1203, in check_gc
    delta = self.gc.delta(gc)
  File 
"/opt/local/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py",
line 1813, in delta
    cmds.extend(cmd(self, *theirs))
  File 
"/opt/local/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py",
line 1725, in hatch_cmd
    name = self.file.hatchPattern(lst)
  File 
"/opt/local/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py",
line 945, in hatchPattern
    return pattern[0]
AttributeError: Name instance has no attribute '__getitem__'

If I change the savefig() call to emit EPS or PNG instead, e.g:

plt.savefig('metadata_throughput.eps')

The program works fine, and I get the output I'd expect. Does anyone
have any suggestions about what's going wrong here?

Thanks in advance,

Neil

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to