AttributeError: draw_gouraud_triangle

I am using the svn matplotlib (1.0.svn) and when I try to plot a histogram I get an AttributeError for draw_gouraud_triangle (traceback below). I have not had this problem in the past. Is anyone else experiencing this?

Thanks,

  • Chuck

In [3]: x = mu + sigma*randn(100000)

In [4]: hist(x, 50, normed=1)
Out[4]:
(array([ 7.75874990e-06, 3.87937495e-06, 1.16381249e-05,
1.55174998e-05, 2.32762497e-05, 5.81906243e-05,
1.08622499e-04, 1.90089373e-04, 3.06470621e-04,
4.65524994e-04, 6.63373117e-04, 1.13277749e-03,
1.81942685e-03, 2.57590497e-03, 3.74359683e-03,
5.14405118e-03, 7.07985929e-03, 8.96135614e-03,
1.12695842e-02, 1.40937692e-02, 1.68791604e-02,
1.98623997e-02, 2.23839935e-02, 2.42577316e-02,
2.57629290e-02, 2.64883722e-02, 2.65194072e-02,
2.52353341e-02, 2.41995409e-02, 2.24305460e-02,
2.01727497e-02, 1.67782967e-02, 1.41829948e-02,
1.20764942e-02, 9.27170613e-03, 6.88589054e-03,
5.33414056e-03, 3.73971745e-03, 2.76211497e-03,
1.85822060e-03, 1.20648561e-03, 8.30186239e-04,
4.65524994e-04, 2.79314996e-04, 1.70692498e-04,
9.69843738e-05, 8.14668740e-05, 3.10349996e-05,
3.87937495e-06, 1.55174998e-05]),
array([ 32.88436884, 35.46210369, 38.03983854, 40.61757339,
43.19530823, 45.77304308, 48.35077793, 50.92851278,
53.50624763, 56.08398247, 58.66171732, 61.23945217,
63.81718702, 66.39492187, 68.97265671, 71.55039156,
74.12812641, 76.70586126, 79.28359611, 81.86133096,
84.4390658 , 87.01680065, 89.5945355 , 92.17227035,
94.7500052 , 97.32774004, 99.90547489, 102.48320974,
105.06094459, 107.63867944, 110.21641429, 112.79414913,
115.37188398, 117.94961883, 120.52735368, 123.10508853,
125.68282337, 128.26055822, 130.83829307, 133.41602792,
135.99376277, 138.57149761, 141.14923246, 143.72696731,
146.30470216, 148.88243701, 151.46017186, 154.0379067 ,
156.61564155, 159.1933764 , 161.77111125]),
<a list of 50 Patch objects>)

Exception in Tkinter callback
Traceback (most recent call last):
File “/usr/lib/python2.5/lib-tk/Tkinter.py”, line 1417, in call
return self.func(*args)
File “/home/chuck/matplotlib/trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py”, line 212, in resize
self.show()
File “/home/chuck/matplotlib/trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py”, line 215, in draw
FigureCanvasAgg.draw(self)
File “/home/chuck/matplotlib/trunk/matplotlib/lib/matplotlib/backends/backend_agg.py”, line 377, in draw

self.renderer = self.get_renderer()

File “/home/chuck/matplotlib/trunk/matplotlib/lib/matplotlib/backends/backend_agg.py”, line 388, in get_renderer
self.renderer = RendererAgg(w, h, self.figure.dpi)

File “/home/chuck/matplotlib/trunk/matplotlib/lib/matplotlib/backends/backend_agg.py”, line 65, in init
self._update_methods()
File “/home/chuck/matplotlib/trunk/matplotlib/lib/matplotlib/backends/backend_agg.py”, line 82, in _update_methods

self.draw_gouraud_triangle = self._renderer.draw_gouraud_triangle

AttributeError: draw_gouraud_triangle

Have you tried removing the build directory to force a full rebuild?
draw_gouraud_triangle was recently added to the _backend_agg extension,
so I would guess for some reason it is still loading an old version of
that extension. If forcing the full rebuild doesn’t help, can you send
the output of your build?

Cheers,

Mike

···

http://p.sf.net/sfu/bobj-julyMatplotlib-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/matplotlib-users

Michael,
Thanks, I rebuilt and now hist is working again.

  • Chuck
···

On Wed, Aug 19, 2009 at 12:08 PM, Michael Droettboom <mdroe@…86…> wrote:

Have you tried removing the build directory to force a full rebuild?
draw_gouraud_triangle was recently added to the _backend_agg extension,
so I would guess for some reason it is still loading an old version of
that extension. If forcing the full rebuild doesn’t help, can you send
the output of your build?

Cheers,

Mike

On 08/19/2009 10:59 AM, Chuck Pepe-Ranney wrote:

I am using the svn matplotlib (1.0.svn) and when I try to
plot a histogram I get an AttributeError for draw_gouraud_triangle
(traceback below). I have not had this problem in the past. Is anyone
else experiencing this?

Thanks,

  • Chuck

In [3]: x = mu + sigma*randn(100000)

In [4]: hist(x, 50, normed=1)

Out[4]:

(array([ 7.75874990e-06, 3.87937495e-06, 1.16381249e-05,

     1.55174998e-05,   2.32762497e-05,   5.81906243e-05,

     1.08622499e-04,   1.90089373e-04,   3.06470621e-04,

     4.65524994e-04,   6.63373117e-04,   1.13277749e-03,

     1.81942685e-03,   2.57590497e-03,   3.74359683e-03,

     5.14405118e-03,   7.07985929e-03,   8.96135614e-03,

     1.12695842e-02,   1.40937692e-02,   1.68791604e-02,

     1.98623997e-02,   2.23839935e-02,   2.42577316e-02,

     2.57629290e-02,   2.64883722e-02,   2.65194072e-02,

     2.52353341e-02,   2.41995409e-02,   2.24305460e-02,

     2.01727497e-02,   1.67782967e-02,   1.41829948e-02,

     1.20764942e-02,   9.27170613e-03,   6.88589054e-03,

     5.33414056e-03,   3.73971745e-03,   2.76211497e-03,

     1.85822060e-03,   1.20648561e-03,   8.30186239e-04,

     4.65524994e-04,   2.79314996e-04,   1.70692498e-04,

     9.69843738e-05,   8.14668740e-05,   3.10349996e-05,

     3.87937495e-06,   1.55174998e-05]),

array([ 32.88436884, 35.46210369, 38.03983854, 40.61757339,

     43.19530823,   45.77304308,   48.35077793,   50.92851278,

     53.50624763,   56.08398247,   58.66171732,   61.23945217,

     63.81718702,   66.39492187,   68.97265671,   71.55039156,

     74.12812641,   76.70586126,   79.28359611,   81.86133096,

     84.4390658 ,   87.01680065,   89.5945355 ,   92.17227035,

     94.7500052 ,   97.32774004,   99.90547489,  102.48320974,

    105.06094459,  107.63867944,  110.21641429,  112.79414913,

    115.37188398,  117.94961883,  120.52735368,  123.10508853,

    125.68282337,  128.26055822,  130.83829307,  133.41602792,

    135.99376277,  138.57149761,  141.14923246,  143.72696731,

    146.30470216,  148.88243701,  151.46017186,  154.0379067 ,

    156.61564155,  159.1933764 ,  161.77111125]),

<a list of 50 Patch objects>)

Exception in Tkinter callback

Traceback (most recent call last):

File “/usr/lib/python2.5/lib-tk/Tkinter.py”, line 1417, in call

return self.func(*args)

File
“/home/chuck/matplotlib/trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py”,
line 212, in resize

self.show()

File
“/home/chuck/matplotlib/trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py”,
line 215, in draw

FigureCanvasAgg.draw(self)

File
“/home/chuck/matplotlib/trunk/matplotlib/lib/matplotlib/backends/backend_agg.py”,
line 377, in draw

self.renderer = self.get_renderer()

File
“/home/chuck/matplotlib/trunk/matplotlib/lib/matplotlib/backends/backend_agg.py”,
line 388, in get_renderer

self.renderer = RendererAgg(w, h, self.figure.dpi)

File
“/home/chuck/matplotlib/trunk/matplotlib/lib/matplotlib/backends/backend_agg.py”,
line 65, in init

self._update_methods()

File
“/home/chuck/matplotlib/trunk/matplotlib/lib/matplotlib/backends/backend_agg.py”,
line 82, in _update_methods

self.draw_gouraud_triangle = self._renderer.draw_gouraud_triangle

AttributeError: draw_gouraud_triangle



---

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. [http://p.sf.net/sfu/bobj-july](http://p.sf.net/sfu/bobj-july)


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

Hi all,
At the Scipy2009 conference I was recently told I could get better performance from matplotlib through an ssh tunnel by using a different backend. However, I can't find any introductory material on this, just function docs for backend_bases module. What part of the matplotlib call includes backend specification? What backends work well for ssh tunnels?

Cheers,
Mike

GTK and WX should work best working over ssh, and I think GTKCairo,
since these should send the drawing commands over X11 rather than the
entire raster which the *Agg backends send. We should put this in the
backends FAQ, but for now there is some additional relevant info
there:

http://matplotlib.sourceforge.net/faq/installing_faq.html#backends

···

On Fri, Aug 21, 2009 at 6:44 PM, Michael Cohen<mcohen@...256...> wrote:

Hi all,
At the Scipy2009 conference I was recently told I could get better
performance from matplotlib through an ssh tunnel by using a different
backend. However, I can't find any introductory material on this, just
function docs for backend_bases module. What part of the matplotlib
call includes backend specification? What backends work well for ssh
tunnels?

Hi all,

I have a plot that has say 6 black X's, each separate, and 6 blue X's, also separate, denoting where x's 1-6 have moved to (from black to blue).
Currently each point is plotted with a separate plot function.
I would like to generate a plot where each black x and blue x pair has an arrow pointing from one to the other.

Currently I plot them like this:

x1black = value
y1black = value
plot([x1black],[y1black],'kx',markersize=10,markeredgewidth=2)
x1blue = value
y1blue = value
plot([x1blue],[y1blue],'bx',markersize=10,markeredgewidth=2)

If I plotted,
plot([x1black,x1blue],[y1black,y1blue])
I could make the line between them into an arrow, but I wouldn't be able to make one blue and the other black.

Also, I'd like to be able to curve my arrows to make them less confusing in case they intersect too much.

Can anyone point me to the right functions?

Cheers
Michael

Hi Michael,

Take a look at the quiver demo
<http://matplotlib.sourceforge.net/examples/pylab_examples/quiver_demo.html&gt;

and the annotation2 demo
<http://matplotlib.sourceforge.net/examples/pylab_examples/quiver_demo.html&gt;

More generally, have a look through the examples and gallery pages
<http://matplotlib.sf.net/examples/index.html&gt;
<http://matplotlib.sf.net/gallery.html&gt;

Gary R.

Michael Cohen wrote:

···

Hi all,

I have a plot that has say 6 black X's, each separate, and 6 blue X's, also separate, denoting where x's 1-6 have moved to (from black to blue).
Currently each point is plotted with a separate plot function.
I would like to generate a plot where each black x and blue x pair has an arrow pointing from one to the other.

Currently I plot them like this:

x1black = value
y1black = value
plot([x1black],[y1black],'kx',markersize=10,markeredgewidth=2)
x1blue = value
y1blue = value
plot([x1blue],[y1blue],'bx',markersize=10,markeredgewidth=2)

If I plotted,
plot([x1black,x1blue],[y1black,y1blue])
I could make the line between them into an arrow, but I wouldn't be able to make one blue and the other black.

Also, I'd like to be able to curve my arrows to make them less confusing in case they intersect too much.

Can anyone point me to the right functions?

Cheers
Michael

Hi,
2009/11/29 Michael Cohen <mcohen@…256…>

Hi all,

I have a plot that has say 6 black X’s, each separate, and 6 blue X’s,

also separate, denoting where x’s 1-6 have moved to (from black to blue).

Currently each point is plotted with a separate plot function.

I would like to generate a plot where each black x and blue x pair has

an arrow pointing from one to the other.

See this cookbook entry: <http://www.scipy.org/Cookbook/Matplotlib/Arrows>

What I usually do in these circumstances (and what is demonstrated in
the cookbook entry) is to plot the points, and then add an arrow patch for each pair:

arrow = pylab.Arrow ( x_from, y_from, distance_x, distance_y )

ax = pylab.gca()

ax.add_patch(arrow)

Hope that helps!
Jose

The arrows worked quite well, but I can't figure out how to curve them in a natural way, so they don't overlap. Also, how do I alter the breadth of the arrowhead, and to make it the same size along arrows of all lengths?

Cheers,
Mike

Jose Gomez-Dans wrote:

···

Hi,
2009/11/29 Michael Cohen <mcohen@...256... <mailto:mcohen@…256…>>

    Hi all,

    I have a plot that has say 6 black X's, each separate, and 6 blue X's,
    also separate, denoting where x's 1-6 have moved to (from black to
    blue).
    Currently each point is plotted with a separate plot function.
    I would like to generate a plot where each black x and blue x pair has
    an arrow pointing from one to the other.

See this cookbook entry: <http://www.scipy.org/Cookbook/Matplotlib/Arrows&gt;

What I usually do in these circumstances (and what is demonstrated in the cookbook entry) is to plot the points, and then add an arrow patch for each pair:
arrow = pylab.Arrow ( x_from, y_from, distance_x, distance_y )
ax = pylab.gca()
ax.add_patch(arrow)

Hope that helps!
Jose