[Matplotlib-users] Why are all my plots displayed as closed loops?

Paul D. DeRocco pderocco at ix.netcom.com
Mon Jun 6 01:49:56 EDT 2016


> From: Christoph Gohlke
> 
> Looks like a bug in the GTK backend at least on Windows. Here's a 
> shorter example
> 
> import numpy
> import matplotlib
> matplotlib.use('GTK')
> from matplotlib import pyplot
> x = numpy.arange(-9, 12)
> pyplot.plot(x, x*x)
> pyplot.show()
> 
> Try to skip the last point in the polygon at 
> matplotlib/backends/backend_gdk.py#L101: 
> self.gdkDrawable.draw_lines(gc.gdkGC, polygon[:-1])
> 
> <https://github.com/matplotlib/matplotlib/blob/v1.5.x/lib/matp
> lotlib/backends/backend_gdk.py#L101>

Thanks to you and to Tom Caswell for checking into this. That probably is
where the bug lies. BrenBarn over on Stackoverflow had the simplest
solution, though: use the GTKAgg backend instead of the GTK backend.

-- 

Ciao,               Paul D. DeRocco
Paul                mailto:pderocco at ix.netcom.com



More information about the Matplotlib-users mailing list