Hi,
I have got the following error with the following code:
$ python mpl.py
Traceback (most recent call last):
File “/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_gtk.py”, line 398, in expose_event
self._render_figure(self._pixmap, w, h)
File “/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_gtkagg.py”, line 75, in _render_figure
FigureCanvasAgg.draw(self)
File “/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py”, line 416, in draw
self.renderer = self.get_renderer()
File “/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py”, line 435, in get_renderer
self.renderer = RendererAgg(w, h, self.figure.dpi)
File “/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py”, line 72, in init
self._renderer = _RendererAgg(int(width), int(height), dpi, debug=False)
ValueError: width and height must each be below 32768
The program ‘mpl.py’ received an X Window System error.
This probably reflects a bug in the program.
The error was ‘BadAlloc (insufficient resources for operation)’.
(Details: serial 486 error_code 11 request_code 53 minor_code 0)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
With the following code:
*import random *
*import matplotlib.pyplot as plt *
···
**
_coverages = [random.randint(1,10)*2] * 4605 _
_contig_names = [‘AAB0008r’] * len(coverages) _
*# Set the figure size *
*#fig = plt.figure(1, [20, 2]) *
_fig = plt.figure(figsize=(int(len(coverages)*0.1), 4)) _
**
*ax = fig.add_subplot(111) *
**
*# Set the x-axis limit *
*#ax.set_xlim(-1,100) *
*ax.set_xlim(0,len(coverages)) *
*#ax.set_ylim(0,3) *
*ax.yaxis.grid(True, linestyle=’-’, which=‘major’, color=‘grey’, alpha=0.5) *
**
*ind = range(len(coverages)) *
*rects = ax.bar(ind, coverages, width=0.1, align=‘center’, color=‘thistle’) *
*ax.set_xticks(ind) *
#ax.set_xticklabels(contig_names)
#ax.tick_params(axis=‘both’, which=‘major’, labelsize=10)
#ax.tick_params(axis=‘both’, which=‘minor’, labelsize=8)
#function to auto-rotate the x axis labels
fig.autofmt_xdate()
plt.setp(ax.get_xticklabels(), fontsize=8, rotation=‘vertical’)
plt.show()
How is it possible to get big charts?
Thank you in advance.