From nishan.singh.mann at gmail.com Wed Jun 1 18:13:31 2016 From: nishan.singh.mann at gmail.com (Nishan Singh Mann) Date: Wed, 01 Jun 2016 22:13:31 +0000 Subject: [Matplotlib-users] Minus signs for zticklabels absent when saved as PDF, unless manually specified Message-ID: Hello all, First up, the prerequisites, - uname -a: Linux macallan3 3.16.0-71-generic #92~14.04.1-Ubuntu SMP Thu May 12 23:31:46 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux - matplotlib version: '1.3.1' - install location: '/usr/lib/python3/dist-packages/matplotlib/__init__.py' - installed via apt-get. - no customizations to my rc file have been done Consider the following test code # ----------------------------- # import numpy as np import matplotlib as mpl from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D fig = plt.figure() ax = fig.gca(projection='3d') x = np.linspace(-1, 1) y = np.linspace(-1, 1) (xx, yy) = np.meshgrid(x, y) ax.plot(x, y, x+y) # ax.set_zticklabels(['-2', '-1.5', '-1.0', '-0.5', '0', '0.5', '1.0', '1.5', '2.0']) plt.savefig('test.pdf') plt.show() # ----------------------------- # On my machine, this saves the figure as a pdf but the minus signs in front of the negative zticklabels are missing. If I now manually set the zticklabels by un-commenting the line above, the minus signs appear in the pdf. This only occurs when saving as a .pdf. Saving as .jpg, .png, .eps, .ps file has no problems. Can anyone else reproduce this issue? Regards, Nishan Mann -- Nishan Singh Mann -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Wed Jun 1 18:29:00 2016 From: tcaswell at gmail.com (Thomas Caswell) Date: Wed, 01 Jun 2016 22:29:00 +0000 Subject: [Matplotlib-users] Minus signs for zticklabels absent when saved as PDF, unless manually specified In-Reply-To: References: Message-ID: I can not reproduce this on 2.0.0b1 which means we fixed this bug at some point between 1.3.1 and now. Is it possible to get a newer version of mpl? Tom On Wed, Jun 1, 2016 at 6:13 PM Nishan Singh Mann < nishan.singh.mann at gmail.com> wrote: > Hello all, > First up, the prerequisites, > > - uname -a: Linux macallan3 3.16.0-71-generic #92~14.04.1-Ubuntu SMP > Thu May 12 23:31:46 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux > - matplotlib version: '1.3.1' > - install > location: '/usr/lib/python3/dist-packages/matplotlib/__init__.py' > - installed via apt-get. > - no customizations to my rc file have been done > > Consider the following test code > # ----------------------------- # > import numpy as np > import matplotlib as mpl > from matplotlib import pyplot as plt > from mpl_toolkits.mplot3d import Axes3D > > fig = plt.figure() > ax = fig.gca(projection='3d') > x = np.linspace(-1, 1) > y = np.linspace(-1, 1) > (xx, yy) = np.meshgrid(x, y) > ax.plot(x, y, x+y) > # ax.set_zticklabels(['-2', '-1.5', '-1.0', '-0.5', '0', '0.5', '1.0', > '1.5', '2.0']) > plt.savefig('test.pdf') > plt.show() > # ----------------------------- # > On my machine, this saves the figure as a pdf but the minus signs in front > of the negative zticklabels are missing. If I now manually set the > zticklabels by un-commenting the line above, the minus signs appear in the > pdf. This only occurs when saving as a .pdf. Saving as .jpg, .png, .eps, > .ps file has no problems. Can anyone else reproduce this issue? > > Regards, > Nishan Mann > > -- > Nishan Singh Mann > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From grivet at cnrs-orleans.fr Fri Jun 3 06:12:05 2016 From: grivet at cnrs-orleans.fr (grivet) Date: Fri, 3 Jun 2016 12:12:05 +0200 Subject: [Matplotlib-users] mouse cursor coordinates In-Reply-To: <6d397a8a-8b9d-3c58-e4ad-eb640a02c3a5@cnrs-orleans.fr> References: <70ce75f7-c8d7-58b8-06c4-3f859646a2ed@cnrs-orleans.fr> <3fbfd83e-f164-ccb1-9644-391cd4735a42@yahoo.com> <6d397a8a-8b9d-3c58-e4ad-eb640a02c3a5@cnrs-orleans.fr> Message-ID: Hello, I would like to go further and, in fact, do the following: repeat n times click inside a figure retrieve and store the pointer coordinates show a mark (or circle or whatever) at this point Thank you for your suggestions JP Grivet > Right again! A separate window is now created and I can click inside > and retrieve the pointer coordinates. > Thanks a lot, > JP Grivet > >> Ok, I do not use spyder so I may be wrong, but it looks that it works if >> in the preferences windows (Tools -> Preferences) >> in the option: >> "IPython console" >> In the tab: >> "Graphics" >> you select the Backend: >> "Automatic" >> >> You probably have to restart spyder for it to work. >> >> Regards, >> Juan From tcaswell at gmail.com Fri Jun 3 08:30:56 2016 From: tcaswell at gmail.com (Thomas Caswell) Date: Fri, 03 Jun 2016 12:30:56 +0000 Subject: [Matplotlib-users] mouse cursor coordinates In-Reply-To: References: <70ce75f7-c8d7-58b8-06c4-3f859646a2ed@cnrs-orleans.fr> <3fbfd83e-f164-ccb1-9644-391cd4735a42@yahoo.com> <6d397a8a-8b9d-3c58-e4ad-eb640a02c3a5@cnrs-orleans.fr> Message-ID: See the spline example in this gist https://gist.github.com/tacaswell/d1afcf015fc202c311bdcc477e1ca3bd and http://matplotlib.org/users/event_handling.html The trick is to register an instance method into the callbacks so that you can keep state between calls. Tom On Fri, Jun 3, 2016 at 6:12 AM grivet wrote: > Hello, > I would like to go further and, in fact, do the following: > > repeat n times > click inside a figure > retrieve and store the pointer coordinates > show a mark (or circle or whatever) at this point > > Thank you for your suggestions > JP Grivet > > > Right again! A separate window is now created and I can click inside > > and retrieve the pointer coordinates. > > Thanks a lot, > > JP Grivet > > > >> Ok, I do not use spyder so I may be wrong, but it looks that it works if > >> in the preferences windows (Tools -> Preferences) > >> in the option: > >> "IPython console" > >> In the tab: > >> "Graphics" > >> you select the Backend: > >> "Automatic" > >> > >> You probably have to restart spyder for it to work. > >> > >> Regards, > >> Juan > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From grivet at cnrs-orleans.fr Fri Jun 3 09:58:13 2016 From: grivet at cnrs-orleans.fr (grivet) Date: Fri, 3 Jun 2016 15:58:13 +0200 Subject: [Matplotlib-users] mouse cursor coordinates In-Reply-To: References: <70ce75f7-c8d7-58b8-06c4-3f859646a2ed@cnrs-orleans.fr> <3fbfd83e-f164-ccb1-9644-391cd4735a42@yahoo.com> <6d397a8a-8b9d-3c58-e4ad-eb640a02c3a5@cnrs-orleans.fr> Message-ID: <31a269ac-4330-69cf-1ac9-5937088de5e5@cnrs-orleans.fr> I know the examples in http://matplotlib.org/users/event_handling.html but they don't do what I want. The next example is quite complex, and I don't understand much of it. > https://gist.github.com/tacaswell/d1afcf015fc202c311bdcc477e1ca3bd and > http://matplotlib.org/users/event_handling.html > I am used to programming in Scilab (or Matlab) and I wish to emulate the following piece of code, in which I place 4 electric charges (of both signs) inside a rectangle in order to compute later the resulting electric field. //define plot window a = gca(); a.tight_limits = "on"; xsetech(wrect=[0,0,1,1],frect=[-5,-5,5,5],arect = 0.99*[1,1,1,1]); np = 4; i = 1; xinfo(""left click in window to place a charge (4 in all)"); while i <= np [ib,xx,yy] = xclick(); //retrieve button number and pointer coordinates if abs(xx) < 5 & abs(yy) < 5 & ib==3 //inside plot and left button xs(i) = xx; ys(i)=yy; charge(i) = evstr(x_dialog("charge value: ","1")); if charge(i) >0 then plot2d(xs(i),ys(i),style = -4,strf="002") //blue dot else plot2d(xs(i),ys(i),style = -5,strf="002") //red dot end i = i+1; end xinfo("left click in window to place a charge (" + string(5-i) + " charge(s) remaining)"); end ....... Is it possible to write an analogous Python code ? From tcaswell at gmail.com Fri Jun 3 13:56:37 2016 From: tcaswell at gmail.com (Thomas Caswell) Date: Fri, 03 Jun 2016 17:56:37 +0000 Subject: [Matplotlib-users] v2.0.0b1 release Message-ID: Folks, We tagged the first beta for v2.0.0 last week and I sent the announcement to the old user mailing list instead of the new one (sorry about that and sorry to those of you getting this twice). Please check out the new defaults! This is tagged as a beta because we anticipate a longer than normal release cycle. The style changes are substantial and we want to make sure that we have not crippled any common use cases. The target for the final release around scipy. A build of the docs is available at http://matplotlib.org/2.0.0b1 Preview packages are available via conda: conda install -c conda-forge/label/rc -c conda-forge matplotlib or pypi python -m pip install --upgrade pip # upgrade pip to latest pip install --pre matplotlib Brief release notes: This previews the new default style and many bug-fixes. A full list of the style changes will be collected for the final release. In addition to the style change this release includes: - overhaul of font handling/text rendering to be faster and clearer - many new rcParams - Agg based OSX backend - optionally deterministic SVGs - complete re-write of image handling code - simplified color conversion - specify colors in the global property cycle via `'C0'`, `'C1'`... `'C9'` - use the global property cycle more places (bar, stem, scatter) There is a 'classic' style sheet which reproduces the 1.Y defaults: import matplotlib.style as mstyle mstyle.use('classic') A big thank you to everyone who worked on this release. Tom -------------- next part -------------- An HTML attachment was scrubbed... URL: From nishan.singh.mann at gmail.com Sat Jun 4 11:08:40 2016 From: nishan.singh.mann at gmail.com (Nishan Singh Mann) Date: Sat, 04 Jun 2016 15:08:40 +0000 Subject: [Matplotlib-users] Minus signs for zticklabels absent when saved as PDF, unless manually specified In-Reply-To: References: Message-ID: Thank Thomas, I concur. I just tried this on a machine running Ubuntu 16.04, matplotlib version 1.5.1 and issue is absent. Guess I will just use pip or upgrade my distro. Nishan On Wed, 1 Jun 2016 at 18:29 Thomas Caswell wrote: > I can not reproduce this on 2.0.0b1 which means we fixed this bug at some > point between 1.3.1 and now. > > Is it possible to get a newer version of mpl? > > Tom > > On Wed, Jun 1, 2016 at 6:13 PM Nishan Singh Mann < > nishan.singh.mann at gmail.com> wrote: > >> Hello all, >> First up, the prerequisites, >> >> - uname -a: Linux macallan3 3.16.0-71-generic #92~14.04.1-Ubuntu SMP >> Thu May 12 23:31:46 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux >> - matplotlib version: '1.3.1' >> - install >> location: '/usr/lib/python3/dist-packages/matplotlib/__init__.py' >> - installed via apt-get. >> - no customizations to my rc file have been done >> >> Consider the following test code >> # ----------------------------- # >> import numpy as np >> import matplotlib as mpl >> from matplotlib import pyplot as plt >> from mpl_toolkits.mplot3d import Axes3D >> >> fig = plt.figure() >> ax = fig.gca(projection='3d') >> x = np.linspace(-1, 1) >> y = np.linspace(-1, 1) >> (xx, yy) = np.meshgrid(x, y) >> ax.plot(x, y, x+y) >> # ax.set_zticklabels(['-2', '-1.5', '-1.0', '-0.5', '0', '0.5', '1.0', >> '1.5', '2.0']) >> plt.savefig('test.pdf') >> plt.show() >> # ----------------------------- # >> On my machine, this saves the figure as a pdf but the minus signs in >> front of the negative zticklabels are missing. If I now manually set the >> zticklabels by un-commenting the line above, the minus signs appear in the >> pdf. This only occurs when saving as a .pdf. Saving as .jpg, .png, .eps, >> .ps file has no problems. Can anyone else reproduce this issue? >> >> Regards, >> Nishan Mann >> >> -- >> Nishan Singh Mann >> > _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> > -- Nishan Singh Mann -------------- next part -------------- An HTML attachment was scrubbed... URL: From pderocco at ix.netcom.com Sat Jun 4 18:33:33 2016 From: pderocco at ix.netcom.com (Paul D. DeRocco) Date: Sat, 4 Jun 2016 15:33:33 -0700 Subject: [Matplotlib-users] Why are all my plots displayed as closed loops? Message-ID: <551A3B0FB75B418BA043887E4B10769D@PAULD> Using Matplotlib 1.5.1, PyGTK 2.24.2, Python 2.7.11 Everything I plot has a straight line connecting the end of the graph back to the beginning. I've posted some sample code, along with screen caps of the results, at Stackoverflow: http://preview.tinyurl.com/hb62una I'm new at Matplotlib, so I must be doing something wrong. -- Ciao, Paul D. DeRocco Paul mailto:pderocco at ix.netcom.com From tcaswell at gmail.com Sat Jun 4 20:04:54 2016 From: tcaswell at gmail.com (Thomas Caswell) Date: Sun, 05 Jun 2016 00:04:54 +0000 Subject: [Matplotlib-users] Why are all my plots displayed as closed loops? In-Reply-To: <551A3B0FB75B418BA043887E4B10769D@PAULD> References: <551A3B0FB75B418BA043887E4B10769D@PAULD> Message-ID: In the future, it is best to include a minimal example in your email to the user list. tinyurls (and SO posts) are almost certainly going to rot. `Line2D` draws lines connecting the points in the order you pass them in. If mpl sorted your data based on the x values then you could never plot anything was not a single valued function f(x). Tom On Sat, Jun 4, 2016 at 6:39 PM Paul D. DeRocco wrote: > Using Matplotlib 1.5.1, PyGTK 2.24.2, Python 2.7.11 > > Everything I plot has a straight line connecting the end of the graph back > to the beginning. I've posted some sample code, along with screen caps of > the results, at Stackoverflow: http://preview.tinyurl.com/hb62una > > I'm new at Matplotlib, so I must be doing something wrong. > > -- > > Ciao, Paul D. DeRocco > Paul mailto:pderocco at ix.netcom.com > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pderocco at ix.netcom.com Sun Jun 5 02:56:19 2016 From: pderocco at ix.netcom.com (Paul D. DeRocco) Date: Sat, 4 Jun 2016 23:56:19 -0700 Subject: [Matplotlib-users] Why are all my plots displayed as closed loops? In-Reply-To: References: <551A3B0FB75B418BA043887E4B10769D@PAULD> Message-ID: <78C61993D565454BA65E1469B0EEA3AD@PAULD> > From: Thomas Caswell [mailto:tcaswell at gmail.com] > > `Line2D` draws lines connecting the points in the order you > pass them in. If mpl sorted your data based on the x values > then you could never plot anything was not a single valued > function f(x). That's fine, but in this case that's exactly what I'm trying to plot, so I'm giving it ascending x values. But it's connecting the last point back to the first point, for no obvious reason. I won't try to post the screen caps in the mailing list, which I expect doesn't work, but they are at still at http://preview.tinyurl.com/hb62una for now. But here's the code: --- import numpy import gtk import matplotlib from matplotlib.figure import Figure from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas class junk: def __init__(self): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.connect('destroy', self.destroy) self.window.set_title('junk') self.window.resize(400, 400) self.figure = Figure() self.axes = self.figure.add_axes((0, 0, 1, 1)) self.canvas = FigureCanvas(self.figure) self.canvas.show() self.window.add(self.canvas) self.axes.set_xlim(-10, 12) self.axes.set_ylim(-1, 122) x = numpy.arange(-9, 12) self.axes.plot(x, x * x) self.canvas.draw() self.window.show_all() def destroy(self, widget, data = None): gtk.main_quit() def main(self): gtk.main() if __name__ == '__main__': app = junk() app.main() --- Do you get the same results? How do I make it not do that? -- Ciao, Paul D. DeRocco Paul mailto:pderocco at ix.netcom.com From cgohlke at uci.edu Sun Jun 5 04:31:33 2016 From: cgohlke at uci.edu (Christoph Gohlke) Date: Sun, 5 Jun 2016 01:31:33 -0700 Subject: [Matplotlib-users] Why are all my plots displayed as closed loops? In-Reply-To: <78C61993D565454BA65E1469B0EEA3AD@PAULD> References: <551A3B0FB75B418BA043887E4B10769D@PAULD> <78C61993D565454BA65E1469B0EEA3AD@PAULD> Message-ID: On 6/4/2016 11:56 PM, Paul D. DeRocco wrote: >> From: Thomas Caswell [mailto:tcaswell at gmail.com] >> >> `Line2D` draws lines connecting the points in the order you >> pass them in. If mpl sorted your data based on the x values >> then you could never plot anything was not a single valued >> function f(x). > > That's fine, but in this case that's exactly what I'm trying to plot, so > I'm giving it ascending x values. But it's connecting the last point back > to the first point, for no obvious reason. I won't try to post the screen > caps in the mailing list, which I expect doesn't work, but they are at > still at http://preview.tinyurl.com/hb62una for now. But here's the code: > > --- > import numpy > import gtk > import matplotlib > from matplotlib.figure import Figure > from matplotlib.backends.backend_gtk import FigureCanvasGTK as > FigureCanvas > > class junk: > > def __init__(self): > > self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) > self.window.connect('destroy', self.destroy) > self.window.set_title('junk') > self.window.resize(400, 400) > > self.figure = Figure() > self.axes = self.figure.add_axes((0, 0, 1, 1)) > self.canvas = FigureCanvas(self.figure) > self.canvas.show() > > self.window.add(self.canvas) > > self.axes.set_xlim(-10, 12) > self.axes.set_ylim(-1, 122) > x = numpy.arange(-9, 12) > self.axes.plot(x, x * x) > > self.canvas.draw() > > self.window.show_all() > > def destroy(self, widget, data = None): > > gtk.main_quit() > > def main(self): > > gtk.main() > > if __name__ == '__main__': > > app = junk() > app.main() > --- > > Do you get the same results? How do I make it not do that? > 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]) Christoph From matej.tyc at gmail.com Sun Jun 5 18:36:12 2016 From: matej.tyc at gmail.com (=?UTF-8?B?TWF0xJtqIFTDvcSN?=) Date: Mon, 6 Jun 2016 00:36:12 +0200 Subject: [Matplotlib-users] patch and its border Message-ID: <98fec699-d32d-5abd-5170-b1df5f076614@gmail.com> Hello, consider a case when I want to draw a patch, but it is important how the border is drawn. For example, if I have an aerial photo and I would like to add a rectangle of given dimensions as a reference. Having the rectangle interior white and its border thick and black is good, because it ensures that the reference will be always clearly visible, regardless of whether the photo is dark or bright. However, as the border is thick, it may significantly overlap with the interior, which is highly unwanted, because it will look smaller. Therefore, in this case, I would like to draw the border, but all of it should be outside of the patch primary area. And I am sure that there are use cases for the opposite situation. TL;DR: Take a look at the attached picture to see what I have in mind - I would like to use "outer borders" (red) or "inner borders", or classical ones, depending on my needs. Is there a user possibility to influence how the border is drawn? If not, how difficult would it be to implement this in matplotlib? -------------- next part -------------- A non-text attachment was scrubbed... Name: borders.png Type: image/png Size: 462 bytes Desc: not available URL: From tcaswell at gmail.com Sun Jun 5 21:22:59 2016 From: tcaswell at gmail.com (Thomas Caswell) Date: Mon, 06 Jun 2016 01:22:59 +0000 Subject: [Matplotlib-users] patch and its border In-Reply-To: <98fec699-d32d-5abd-5170-b1df5f076614@gmail.com> References: <98fec699-d32d-5abd-5170-b1df5f076614@gmail.com> Message-ID: I recall there being discussion of controlling if paths are stroked 'inside', 'outside', or 'on' the path, but I can not find a link. One possible work around (which is not super elegant) is to use two rectangles, one drawn with the thick border and one with a `lw=0` and a higher z-order overlayed on top. Tom On Sun, Jun 5, 2016 at 6:36 PM Mat?j T?? wrote: > Hello, > consider a case when I want to draw a patch, but it is important how the > border is drawn. For example, if I have an aerial photo and I would like > to add a rectangle of given dimensions as a reference. Having the > rectangle interior white and its border thick and black is good, because > it ensures that the reference will be always clearly visible, > regardless of whether the photo is dark or bright. > However, as the border is thick, it may significantly overlap with the > interior, which is highly unwanted, because it will look smaller. > Therefore, in this case, I would like to draw the border, but all of it > should be outside of the patch primary area. > And I am sure that there are use cases for the opposite situation. > > TL;DR: Take a look at the attached picture to see what I have in mind - > I would like to use "outer borders" (red) or "inner borders", or > classical ones, depending on my needs. > > Is there a user possibility to influence how the border is drawn? If > not, how difficult would it be to implement this in matplotlib? > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pderocco at ix.netcom.com Mon Jun 6 01:49:56 2016 From: pderocco at ix.netcom.com (Paul D. DeRocco) Date: Sun, 5 Jun 2016 22:49:56 -0700 Subject: [Matplotlib-users] Why are all my plots displayed as closed loops? In-Reply-To: References: <551A3B0FB75B418BA043887E4B10769D@PAULD> <78C61993D565454BA65E1469B0EEA3AD@PAULD> Message-ID: > 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]) > > 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 From efiring at hawaii.edu Mon Jun 6 02:28:41 2016 From: efiring at hawaii.edu (Eric Firing) Date: Sun, 5 Jun 2016 20:28:41 -1000 Subject: [Matplotlib-users] Why are all my plots displayed as closed loops? In-Reply-To: References: <551A3B0FB75B418BA043887E4B10769D@PAULD> <78C61993D565454BA65E1469B0EEA3AD@PAULD> Message-ID: <4276133f-473d-de71-d058-0eafebadf99b@hawaii.edu> On 2016/06/05 7:49 PM, Paul D. DeRocco wrote: > 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. > In fact, I think that deprecating the GTK backend is overdue. Eric From tcaswell at gmail.com Mon Jun 6 08:50:44 2016 From: tcaswell at gmail.com (Thomas Caswell) Date: Mon, 06 Jun 2016 12:50:44 +0000 Subject: [Matplotlib-users] Why are all my plots displayed as closed loops? In-Reply-To: <4276133f-473d-de71-d058-0eafebadf99b@hawaii.edu> References: <551A3B0FB75B418BA043887E4B10769D@PAULD> <78C61993D565454BA65E1469B0EEA3AD@PAULD> <4276133f-473d-de71-d058-0eafebadf99b@hawaii.edu> Message-ID: I spent a bit more time poking at this last night (but was having issues getting the gtk dependencies setup) however it looks like `path.to_ploygons` is not returning a closed polygon. I wonder if the gtk drawing api moved under us? Tom On Mon, Jun 6, 2016 at 2:29 AM Eric Firing wrote: > On 2016/06/05 7:49 PM, Paul D. DeRocco wrote: > > > 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. > > > > In fact, I think that deprecating the GTK backend is overdue. > > Eric > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From grivet at cnrs-orleans.fr Tue Jun 7 05:53:39 2016 From: grivet at cnrs-orleans.fr (grivet) Date: Tue, 7 Jun 2016 11:53:39 +0200 Subject: [Matplotlib-users] mouse cursor coordinates In-Reply-To: <31a269ac-4330-69cf-1ac9-5937088de5e5@cnrs-orleans.fr> References: <70ce75f7-c8d7-58b8-06c4-3f859646a2ed@cnrs-orleans.fr> <3fbfd83e-f164-ccb1-9644-391cd4735a42@yahoo.com> <6d397a8a-8b9d-3c58-e4ad-eb640a02c3a5@cnrs-orleans.fr> <31a269ac-4330-69cf-1ac9-5937088de5e5@cnrs-orleans.fr> Message-ID: <48c861a6-c28f-637d-ef26-97157fb722da@cnrs-orleans.fr> Hello, I am still trying to plot some points inside a figure using the mouse, while storing the points' coordinates for further use. I found the following example, which seems to be a step in the right direction: import matplotlib.pyplot as plt plt.ion() plt.xlim(0, 10) plt.ylim(0, 10) mse = 0 while mse != []: mse = plt.ginput(timeout=10) if mse != []: print(mse) plt.gca().add_artist(plt.Circle(mse[0], 0.1, alpha=0.9)) plt.close() However, when I run this program (Spyder, Python 3.5, Win_7_64), I have to click twice inside the figure to draw a single point. Any suggestion ? JP Grivet From ben.v.root at gmail.com Tue Jun 7 10:57:52 2016 From: ben.v.root at gmail.com (Benjamin Root) Date: Tue, 7 Jun 2016 10:57:52 -0400 Subject: [Matplotlib-users] patch and its border In-Reply-To: References: <98fec699-d32d-5abd-5170-b1df5f076614@gmail.com> Message-ID: This actually intersects a bit with a need of mine in basemap. In basemap, I need to find a clip path that is just slightly bigger than the bounding box of the map limbs so that I am not "shaving" the border line for the map limbs. I guess I could flip the problem around and have the map limbs drawn "inside" the specified polygon so that I don't have to worry about the clip path shaving my limbs (... yes, I know that sounds incredibly silly). On Sun, Jun 5, 2016 at 9:22 PM, Thomas Caswell wrote: > I recall there being discussion of controlling if paths are stroked > 'inside', 'outside', or 'on' the path, but I can not find a link. > > One possible work around (which is not super elegant) is to use two > rectangles, one drawn with the thick border and one with a `lw=0` and a > higher z-order overlayed on top. > > Tom > > On Sun, Jun 5, 2016 at 6:36 PM Mat?j T?? wrote: > >> Hello, >> consider a case when I want to draw a patch, but it is important how the >> border is drawn. For example, if I have an aerial photo and I would like >> to add a rectangle of given dimensions as a reference. Having the >> rectangle interior white and its border thick and black is good, because >> it ensures that the reference will be always clearly visible, >> regardless of whether the photo is dark or bright. >> However, as the border is thick, it may significantly overlap with the >> interior, which is highly unwanted, because it will look smaller. >> Therefore, in this case, I would like to draw the border, but all of it >> should be outside of the patch primary area. >> And I am sure that there are use cases for the opposite situation. >> >> TL;DR: Take a look at the attached picture to see what I have in mind - >> I would like to use "outer borders" (red) or "inner borders", or >> classical ones, depending on my needs. >> >> Is there a user possibility to influence how the border is drawn? If >> not, how difficult would it be to implement this in matplotlib? >> >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alanwilter at gmail.com Thu Jun 16 12:08:46 2016 From: alanwilter at gmail.com (Alan) Date: Thu, 16 Jun 2016 17:08:46 +0100 Subject: [Matplotlib-users] Failing to install matplotlib with python 3 Message-ID: Hi there, I am not the admin so I have installed my own python 3.5.1 and I am using pip3 to install all modules I need. I got all but matplotlib :-( pip3 install -U matplotlib Collecting matplotlib Using cached matplotlib-1.5.1.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 1, in File "/tmp/pip-build-6eka4_fr/matplotlib/setup.py", line 167, in result = package.check() File "/tmp/pip-build-6eka4_fr/matplotlib/setupext.py", line 980, in check min_version='1.2', version=version) File "/tmp/pip-build-6eka4_fr/matplotlib/setupext.py", line 459, in _check_for_pkg_config if (not is_min_version(version, min_version)): File "/tmp/pip-build-6eka4_fr/matplotlib/setupext.py", line 179, in is_min_version return found_version >= expected_version File "/sw/arch/Test2/lib/python3.5/distutils/version.py", line 70, in __ge__ c = self._cmp(other) File "/sw/arch/Test2/lib/python3.5/distutils/version.py", line 337, in _cmp if self.version < other.version: TypeError: unorderable types: str() < int() ============================================================================ Edit setup.cfg to change the build options BUILDING MATPLOTLIB matplotlib: yes [1.5.1] python: yes [3.5.1 (default, Jun 16 2016, 11:03:02) [GCC 4.4.7 20120313 (Red Hat 4.4.7-11)]] platform: yes [linux] REQUIRED DEPENDENCIES AND EXTENSIONS numpy: yes [version 1.11.0] dateutil: yes [using dateutil version 2.5.3] pytz: yes [using pytz version 2016.4] cycler: yes [using cycler version 0.10.0] tornado: yes [using tornado version 4.3] pyparsing: yes [using pyparsing version 2.1.5] libagg: yes [pkg-config information for 'libagg' could not be found. Using local copy.] freetype: yes [version unknown] ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-6eka4_fr/matplotlib/ What am I missing here please? Thanks, Alan PS. btw, with python 2.7.11 all went fine. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jenshnielsen at gmail.com Thu Jun 16 14:36:20 2016 From: jenshnielsen at gmail.com (Jens Nielsen) Date: Thu, 16 Jun 2016 18:36:20 +0000 Subject: [Matplotlib-users] Failing to install matplotlib with python 3 In-Reply-To: References: Message-ID: Looks like LooseVersion gets something that it not quite understand. As far as I can see this is coming from freetype What does running pkg-config --modversion freetype2 on the commandline give? best Jens On Thu, 16 Jun 2016 at 17:09 Alan wrote: > Hi there, > > I am not the admin so I have installed my own python 3.5.1 and I am using > pip3 to install all modules I need. I got all but matplotlib :-( > > pip3 install -U matplotlib > > Collecting matplotlib > Using cached matplotlib-1.5.1.tar.gz > Complete output from command python setup.py egg_info: > Traceback (most recent call last): > File "", line 1, in > File "/tmp/pip-build-6eka4_fr/matplotlib/setup.py", line 167, in > > result = package.check() > File "/tmp/pip-build-6eka4_fr/matplotlib/setupext.py", line 980, in > check > min_version='1.2', version=version) > File "/tmp/pip-build-6eka4_fr/matplotlib/setupext.py", line 459, in > _check_for_pkg_config > if (not is_min_version(version, min_version)): > File "/tmp/pip-build-6eka4_fr/matplotlib/setupext.py", line 179, in > is_min_version > return found_version >= expected_version > File "/sw/arch/Test2/lib/python3.5/distutils/version.py", line 70, > in __ge__ > c = self._cmp(other) > File "/sw/arch/Test2/lib/python3.5/distutils/version.py", line 337, > in _cmp > if self.version < other.version: > TypeError: unorderable types: str() < int() > > ============================================================================ > Edit setup.cfg to change the build options > > BUILDING MATPLOTLIB > matplotlib: yes [1.5.1] > python: yes [3.5.1 (default, Jun 16 2016, 11:03:02) > [GCC > 4.4.7 20120313 (Red Hat 4.4.7-11)]] > platform: yes [linux] > > REQUIRED DEPENDENCIES AND EXTENSIONS > numpy: yes [version 1.11.0] > dateutil: yes [using dateutil version 2.5.3] > pytz: yes [using pytz version 2016.4] > cycler: yes [using cycler version 0.10.0] > tornado: yes [using tornado version 4.3] > pyparsing: yes [using pyparsing version 2.1.5] > libagg: yes [pkg-config information for 'libagg' could > not > be found. Using local copy.] > freetype: yes [version unknown] > > ---------------------------------------- > Command "python setup.py egg_info" failed with error code 1 in > /tmp/pip-build-6eka4_fr/matplotlib/ > > What am I missing here please? > > Thanks, > > Alan > > PS. btw, with python 2.7.11 all went fine. > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From efiring at hawaii.edu Thu Jun 16 15:07:12 2016 From: efiring at hawaii.edu (Eric Firing) Date: Thu, 16 Jun 2016 09:07:12 -1000 Subject: [Matplotlib-users] Failing to install matplotlib with python 3 In-Reply-To: References: Message-ID: <60b79a5a-6b25-ec7e-ddc3-7f8cf252ab83@hawaii.edu> Alan, This mailing list is obsolete; please use matplotlib-users at python.org. Your traceback looks vaguely familiar as something that has come up before, but I don't have any more recollection than that. Suggestions: 1) Install your python environment the easy way via anaconda or miniconda: https://www.continuum.io/downloads 2) If you are *sure* you don't want to do it that way, make sure you have the most recent version of pip. 3) Likewise, install the most recent matplotlib. See attached message. Eric On 2016/06/16 6:07 AM, Alan wrote: > Hi there, > > I am not the admin so I have installed my own python 3.5.1 and I am > using pip3 to install all modules I need. I got all but matplotlib :-( > > pip3 install -U matplotlib > > Collecting matplotlib > Using cached matplotlib-1.5.1.tar.gz > Complete output from command python setup.py egg_info: > Traceback (most recent call last): > File "", line 1, in > File "/tmp/pip-build-6eka4_fr/matplotlib/setup.py", line 167, in > > result = package.check() > File "/tmp/pip-build-6eka4_fr/matplotlib/setupext.py", line 980, > in check > min_version='1.2', version=version) > File "/tmp/pip-build-6eka4_fr/matplotlib/setupext.py", line 459, > in _check_for_pkg_config > if (not is_min_version(version, min_version)): > File "/tmp/pip-build-6eka4_fr/matplotlib/setupext.py", line 179, > in is_min_version > return found_version >= expected_version > File "/sw/arch/Test2/lib/python3.5/distutils/version.py", line 70, > in __ge__ > c = self._cmp(other) > File "/sw/arch/Test2/lib/python3.5/distutils/version.py", line > 337, in _cmp > if self.version < other.version: > TypeError: unorderable types: str() < int() > > ============================================================================ > Edit setup.cfg to change the build options > > BUILDING MATPLOTLIB > matplotlib: yes [1.5.1] > python: yes [3.5.1 (default, Jun 16 2016, 11:03:02) > [GCC > 4.4.7 20120313 (Red Hat 4.4.7-11)]] > platform: yes [linux] > > REQUIRED DEPENDENCIES AND EXTENSIONS > numpy: yes [version 1.11.0] > dateutil: yes [using dateutil version 2.5.3] > pytz: yes [using pytz version 2016.4] > cycler: yes [using cycler version 0.10.0] > tornado: yes [using tornado version 4.3] > pyparsing: yes [using pyparsing version 2.1.5] > libagg: yes [pkg-config information for 'libagg' > could not > be found. Using local copy.] > freetype: yes [version unknown] > > ---------------------------------------- > Command "python setup.py egg_info" failed with error code 1 in > /tmp/pip-build-6eka4_fr/matplotlib/ > > What am I missing here please? > > Thanks, > > Alan > > PS. btw, with python 2.7.11 all went fine. > -------------- next part -------------- An embedded message was scrubbed... From: Matthew Brett Subject: Re: [Matplotlib-devel] REL: v1.5.2rc2 Date: Mon, 30 May 2016 18:28:51 -0700 Size: 7949 URL: From alanwilter at gmail.com Thu Jun 16 15:12:59 2016 From: alanwilter at gmail.com (Alan) Date: Thu, 16 Jun 2016 20:12:59 +0100 Subject: [Matplotlib-users] Failing to install matplotlib with python 3 In-Reply-To: References: Message-ID: Thanks for your help! It gave me the hint to nail the issue. My PATH had a very old pkg-config. I removed and now all worked! Thanks a lot, Alan On 16 June 2016 at 19:36, Jens Nielsen wrote: > Looks like LooseVersion gets something that it not quite understand. As > far as I can see this is coming from freetype > > What does running pkg-config --modversion freetype2 on the commandline > give? > > best > Jens > > On Thu, 16 Jun 2016 at 17:09 Alan wrote: > >> Hi there, >> >> I am not the admin so I have installed my own python 3.5.1 and I am using >> pip3 to install all modules I need. I got all but matplotlib :-( >> >> pip3 install -U matplotlib >> >> Collecting matplotlib >> Using cached matplotlib-1.5.1.tar.gz >> Complete output from command python setup.py egg_info: >> Traceback (most recent call last): >> File "", line 1, in >> File "/tmp/pip-build-6eka4_fr/matplotlib/setup.py", line 167, in >> >> result = package.check() >> File "/tmp/pip-build-6eka4_fr/matplotlib/setupext.py", line 980, in >> check >> min_version='1.2', version=version) >> File "/tmp/pip-build-6eka4_fr/matplotlib/setupext.py", line 459, in >> _check_for_pkg_config >> if (not is_min_version(version, min_version)): >> File "/tmp/pip-build-6eka4_fr/matplotlib/setupext.py", line 179, in >> is_min_version >> return found_version >= expected_version >> File "/sw/arch/Test2/lib/python3.5/distutils/version.py", line 70, >> in __ge__ >> c = self._cmp(other) >> File "/sw/arch/Test2/lib/python3.5/distutils/version.py", line 337, >> in _cmp >> if self.version < other.version: >> TypeError: unorderable types: str() < int() >> >> ============================================================================ >> Edit setup.cfg to change the build options >> >> BUILDING MATPLOTLIB >> matplotlib: yes [1.5.1] >> python: yes [3.5.1 (default, Jun 16 2016, 11:03:02) >> [GCC >> 4.4.7 20120313 (Red Hat 4.4.7-11)]] >> platform: yes [linux] >> >> REQUIRED DEPENDENCIES AND EXTENSIONS >> numpy: yes [version 1.11.0] >> dateutil: yes [using dateutil version 2.5.3] >> pytz: yes [using pytz version 2016.4] >> cycler: yes [using cycler version 0.10.0] >> tornado: yes [using tornado version 4.3] >> pyparsing: yes [using pyparsing version 2.1.5] >> libagg: yes [pkg-config information for 'libagg' >> could not >> be found. Using local copy.] >> freetype: yes [version unknown] >> >> ---------------------------------------- >> Command "python setup.py egg_info" failed with error code 1 in >> /tmp/pip-build-6eka4_fr/matplotlib/ >> >> What am I missing here please? >> >> Thanks, >> >> Alan >> >> PS. btw, with python 2.7.11 all went fine. >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jacob.larson at colorado.edu Thu Jun 16 16:33:59 2016 From: jacob.larson at colorado.edu (Jake Larson) Date: Thu, 16 Jun 2016 20:33:59 +0000 (UTC) Subject: [Matplotlib-users] fancy border for basemap's map? References: Message-ID: Maria Liukis writes: > > Hello, > > I was wondering if there is an option in basemap to put ?fancy? (white and > black skinny rectangles) map > border like the one is available in GMT? Not a perfect fix but works for cylindrical projections. github.com/larsonjl/mapping/blob/master/fancy_map_borders.md From winash12 at gmail.com Tue Jun 21 07:51:37 2016 From: winash12 at gmail.com (ashwinD12 .) Date: Tue, 21 Jun 2016 17:21:37 +0530 Subject: [Matplotlib-users] Need clarification on shiftgrid and addcylic Message-ID: Hello, I am just starting to learn how to plot NCEP reanalysis data using Python3 and matplotlib and basemap. I have some clarifications on how to go about doing it. My dataset is between latitude 5 N to 40 N and 65 E and 100 E. I am trying to plot geopotential height from NCEP reanalysis data. Here is my code - level = 5 time = 0 meters_per_grid = 277830 d = Dataset("hgt_500_2014_12_5_00Z.nc") hgt = d.get_variables_by_attributes(axis="hgt") lon = d.get_variables_by_attributes(axis="lon") lat =d.get_variables_by_attributes(axis="lat") hgt = hgt[::-1] hgt, lon = shiftgrid(180, hgt, lon, start = False Why do I get an IndexError: index out of range on shiftgrid call ? BR, Ashwin. -------------- next part -------------- An HTML attachment was scrubbed... URL: From pmhobson at gmail.com Wed Jun 22 10:45:22 2016 From: pmhobson at gmail.com (Paul Hobson) Date: Wed, 22 Jun 2016 07:45:22 -0700 Subject: [Matplotlib-users] Need clarification on shiftgrid and addcylic In-Reply-To: References: Message-ID: Can you show your imports? Where did shiftgrid come from? On Tue, Jun 21, 2016 at 4:51 AM, ashwinD12 . wrote: > Hello, > I am just starting to learn how to plot NCEP reanalysis data > using Python3 and matplotlib and basemap. I have some clarifications on how > to go about doing it. > > My dataset is between latitude 5 N to 40 N and 65 E and 100 E. > I am trying to plot geopotential height from NCEP reanalysis data. Here is > my code - > > > level = 5 > time = 0 > > meters_per_grid = 277830 > > d = Dataset("hgt_500_2014_12_5_00Z.nc") > hgt = d.get_variables_by_attributes(axis="hgt") > lon = d.get_variables_by_attributes(axis="lon") > lat =d.get_variables_by_attributes(axis="lat") > hgt = hgt[::-1] > hgt, lon = shiftgrid(180, hgt, lon, start = False > > > Why do I get an IndexError: index out of range on shiftgrid call ? > > BR, > Ashwin. > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Wed Jun 22 20:50:56 2016 From: tcaswell at gmail.com (Thomas Caswell) Date: Thu, 23 Jun 2016 00:50:56 +0000 Subject: [Matplotlib-users] When data is graphed with an offset In-Reply-To: References: Message-ID: John, This seems to be a common question ( http://stackoverflow.com/questions/14711655/how-to-prevent-numbers-being-changed-to-exponential-form-in-python-matplotlib-fi/14711866#14711866 ) ax = plt.gca() ax.get_xaxis().get_major_formatter().set_useOffset(False) ax.get_yaxis().get_major_formatter().set_useOffset(False) will control a single axes To control it globally set `axes.formatter.useoffset: False` in rcparams. see http://matplotlib.org/users/customizing.html#a-sample-matplotlibrc-file Where would you have expected to look for this information in the documentation? Tom PS the sourceforge list is no longer used, please send future mail to matplotlib-users at python.org On Wed, Jun 22, 2016 at 8:30 PM John Ladasky wrote: > Hi there, > > I have been subscribed to matplotlib-users before. I have a new job, and > now I'm connecting from a new email address. I've been using Matplotlib > since before 1.0 was released. Currently, I'm using MPL 1.4.2 and Python > 3.5 on Ubuntu Linux 15.04 (if any of that matters). > > Please have a look at the following graph: > > [image: For matplotlib discussion.png] > > The values in the data set used to plot these two graphs range from 14942 > to 14948. In other words, the median of the data set is very far from > zero, but the range of the data is very small. With such a data set, MPL > subtracts a large offset value from the data points, choosing a value such > that the remaining differences are small, positive numbers. I understand > the logic behind this, it simplifies graph labeling on the x-axis of the > left graph, and the y-axis of the right graph. > > However, I do not like the way that MPL is displaying the offset value. > It is written in small text, and it does not show up in a consistent > place. On a figure with many adjacent axes, it sometimes isn't clear which > axes owns the annotation. I would prefer to incorporate the offset in the > axes title: for example, the title of the left graph could read "internal > thermistor (+14940)". > > So, what is this offset value called in Matplotlib? How do I retrieve > it? How can I override its display? I can obviously do this by wrapping > these particular plots in functions which apply the offset before giving > the data to MPL. But I would prefer to work with MPL itself, as I don't > always know when MPL will judge that a data offset value is needed. > > Thanks for your help! > -- > *John J. Ladasky Jr., Ph.D.* > *Research Scientist* > *International Technological University* > *2711 N. First St, San Jose, CA 95134 USA* > > ------------------------------------------------------------------------------ > Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San > Francisco, CA to explore cutting-edge tech and listen to tech luminaries > present their vision of the future. This family event has something for > everyone, including kids. Get more information and register today. > http://sdm.link/attshape_______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: For matplotlib discussion.png Type: image/png Size: 30819 bytes Desc: not available URL: From flyxiaoyu at gmail.com Wed Jun 22 22:43:33 2016 From: flyxiaoyu at gmail.com (Frank Yu) Date: Thu, 23 Jun 2016 10:43:33 +0800 Subject: [Matplotlib-users] fail to build matplotlib on smartos(like open solaris) system Message-ID: Hi there, I am trying build matplotlib on smartos(like open solaris) system. but failed with error. I am build the latest matplotlib. steps as below: # git describe v2.0.0b1-1699-g4b3350d # python setup.py install ============================================================================ Edit setup.cfg to change the build options BUILDING MATPLOTLIB matplotlib: yes [2.0.0b1+1699.g4b3350d] python: yes [2.7.11 (default, Jan 11 2016, 23:16:55) [GCC 4.9.3]] platform: yes [sunos5] REQUIRED DEPENDENCIES AND EXTENSIONS numpy: yes [version 1.11.0] six: yes [The installed version of six is 1.9.0 but a the minimum required version is 1.10. pip/easy install will attempt to install a newer version.] dateutil: yes [using dateutil version 2.4.0] functools32: yes [using functools32] pytz: yes [using pytz version 2014.10] cycler: yes [using cycler version 0.10.0] tornado: yes [using tornado version 4.3] pyparsing: yes [using pyparsing version 2.0.2] libagg: yes [pkg-config information for 'libagg' could not be found. Using local copy.] freetype: yes [version 2.5.5] png: yes [version 1.6.17] qhull: yes [pkg-config information for 'qhull' could not be found. Using local copy.] OPTIONAL SUBPACKAGES sample_data: yes [installing] toolkits: yes [installing] tests: yes [using nose version 1.3.7 / mock is required to run the matplotlib test suite. Please install it with pip or your preferred tool to run the test suite] toolkits_tests: yes [using nose version 1.3.7 / mock is required to run the matplotlib test suite. Please install it with pip or your preferred tool to run the test suite] OPTIONAL BACKEND EXTENSIONS macosx: no [Mac OS-X only] qt5agg: no [PySide2 not found; PyQt5 not found] qt4agg: no [PySide not found; PyQt4 not found] gtk3agg: no [Requires pygobject to be installed.] gtk3cairo: no [Requires pygobject to be installed.] gtkagg: no [Requires pygtk] tkagg: yes [installing; run-time loading from Python Tcl / Tk] wxagg: no [requires wxPython] gtk: no [Requires pygtk] agg: yes [installing] cairo: yes [installing, pycairo version 1.10.0] windowing: no [Microsoft Windows only] OPTIONAL LATEX DEPENDENCIES dvipng: no ghostscript: no latex: no pdftops: no OPTIONAL PACKAGE DATA dlls: no [skipping due to configuration] running install running bdist_egg running egg_info creating lib/matplotlib.egg-info writing requirements to lib/matplotlib.egg-info/requires.txt writing lib/matplotlib.egg-info/PKG-INFO writing namespace_packages to lib/matplotlib.egg-info/namespace_packages.txt writing top-level names to lib/matplotlib.egg-info/top_level.txt writing dependency_links to lib/matplotlib.egg-info/dependency_links.txt writing manifest file 'lib/matplotlib.egg-info/SOURCES.txt' reading manifest file 'lib/matplotlib.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'lib/matplotlib.egg-info/SOURCES.txt' installing library code to build/bdist.solaris-2.11-i86pc.64bit/egg running install_lib running build_py creating build creating build/lib.solaris-2.11-i86pc.64bit-2.7 copying lib/pylab.py -> build/lib.solaris-2.11-i86pc.64bit-2.7 creating build/lib.solaris-2.11-i86pc.64bit-2.7/matplotlib copying lib/matplotlib/_version.py -> build/lib.solaris-2.11-i86pc.64bit-2.7/matplotlib ?............ ?running build_ext building 'matplotlib.ft2font' extension creating build/temp.solaris-2.11-i86pc.64bit-2.7 creating build/temp.solaris-2.11-i86pc.64bit-2.7/src gcc -fno-strict-aliasing -O2 -pipe -O2 -gdwarf-2 -DHAVE_DB_185_H -pthread -I/usr/include -I/opt/local/include -I/opt/local/include/db4 -I/opt/local/include/ncurses -DNDEBUG -O2 -pipe -O2 -gdwarf-2 -DHAVE_DB_185_H -pthread -I/usr/include -I/opt/local/include -I/opt/local/include/db4 -I/opt/local/include/ncurses -fPIC -DFREETYPE_BUILD_TYPE=system -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -I/opt/local/lib/python2.7/site-packages/numpy/core/include -I/opt/local/include/libpng16 -I/opt/local/include -I/opt/local/include/freetype2 -I/usr/local/include -I. -I/opt/local/include/python2.7 -c src/ft2font.cpp -o build/temp.solaris-2.11-i86pc.64bit-2.7/src/ft2font.o gcc -fno-strict-aliasing -O2 -pipe -O2 -gdwarf-2 -DHAVE_DB_185_H -pthread -I/usr/include -I/opt/local/include -I/opt/local/include/db4 -I/opt/local/include/ncurses -DNDEBUG -O2 -pipe -O2 -gdwarf-2 -DHAVE_DB_185_H -pthread -I/usr/include -I/opt/local/include -I/opt/local/include/db4 -I/opt/local/include/ncurses -fPIC -DFREETYPE_BUILD_TYPE=system -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -I/opt/local/lib/python2.7/site-packages/numpy/core/include -I/opt/local/include/libpng16 -I/opt/local/include -I/opt/local/include/freetype2 -I/usr/local/include -I. -I/opt/local/include/python2.7 -c src/ft2font_wrapper.cpp -o build/temp.solaris-2.11-i86pc.64bit-2.7/src/ft2font_wrapper.o In file included from /opt/local/include/python2.7/Python.h:44:0, from src/mplutils.h:21, from src/ft2font_wrapper.cpp:1: /usr/include/unistd.h:521:75: error: declaration of C function 'void swab(const void*, void*, ssize_t)' conflicts with In file included from /opt/local/include/python2.7/Python.h:42:0, from src/mplutils.h:21, from src/ft2font_wrapper.cpp:1: /usr/include/stdlib.h:170:13: error: previous declaration 'void swab(const char*, char*, ssize_t)' here error: command 'gcc' failed with exit status 1 ?The error is clear, swab was declared twice in both unistd.h and stdlib.h # sed -n 519,522p /usr/include/unistd.h #if defined(_XPG4) /* __EXTENSIONS__ makes the SVID Third Edition prototype in stdlib.h visible */ extern void swab(const void *_RESTRICT_KYWD, void *_RESTRICT_KYWD, ssize_t); #endif /* defined(_XPG4) */ # sed -n 170p /usr/include/stdlib.h extern void swab(const char *, char *, ssize_t);? # sed -n 158,171p /usr/include/stdlib.h #if (defined(__EXTENSIONS__) || \ (!defined(_STRICT_STDC__) && !defined(_POSIX_C_SOURCE))) && \ (!defined(_XOPEN_SOURCE) || (defined(_XPG3) && !defined(_XPG4))) #ifndef _SSIZE_T #define _SSIZE_T #if defined(_LP64) || defined(_I32LPx) typedef long ssize_t; /* size of something in bytes or -1 */ #else typedef int ssize_t; /* (historical version) */ #endif #endif /* !_SSIZE_T */ extern void swab(const char *, char *, ssize_t); #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */ ?I saw someone has asked this question, but can't get a proper answer. ? -- Regards Frank Yu -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Wed Jun 22 22:51:22 2016 From: tcaswell at gmail.com (Thomas Caswell) Date: Thu, 23 Jun 2016 02:51:22 +0000 Subject: [Matplotlib-users] [Matplotlib-devel] fail to build matplotlib on smartos(like open solaris) system In-Reply-To: References: Message-ID: xref: https://github.com/matplotlib/matplotlib/issues/6528 which has a more readable version of the error. The question I asked in the other thread still stands, can you build _any_ c program that includes `Python.h`? Tom On Wed, Jun 22, 2016 at 10:43 PM Frank Yu wrote: > Hi there, > > I am trying build matplotlib on smartos(like open solaris) system. but > failed with error. I am build the latest matplotlib. steps as below: > > > # git describe > > v2.0.0b1-1699-g4b3350d > > # python setup.py install > > > ============================================================================ > > Edit setup.cfg to change the build options > > > BUILDING MATPLOTLIB > > matplotlib: yes [2.0.0b1+1699.g4b3350d] > > python: yes [2.7.11 (default, Jan 11 2016, 23:16:55) [GCC > > 4.9.3]] > > platform: yes [sunos5] > > > REQUIRED DEPENDENCIES AND EXTENSIONS > > numpy: yes [version 1.11.0] > > six: yes [The installed version of six is 1.9.0 but a > the > > minimum required version is 1.10. pip/easy install > > will attempt to install a newer version.] > > dateutil: yes [using dateutil version 2.4.0] > > functools32: yes [using functools32] > > pytz: yes [using pytz version 2014.10] > > cycler: yes [using cycler version 0.10.0] > > tornado: yes [using tornado version 4.3] > > pyparsing: yes [using pyparsing version 2.0.2] > > libagg: yes [pkg-config information for 'libagg' could not > > be found. Using local copy.] > > freetype: yes [version 2.5.5] > > png: yes [version 1.6.17] > > qhull: yes [pkg-config information for 'qhull' could not > be > > found. Using local copy.] > > > OPTIONAL SUBPACKAGES > > sample_data: yes [installing] > > toolkits: yes [installing] > > tests: yes [using nose version 1.3.7 / mock is required to > > run the matplotlib test suite. Please install it > > with pip or your preferred tool to run the test > > suite] > > toolkits_tests: yes [using nose version 1.3.7 / mock is required to > > run the matplotlib test suite. Please install it > > with pip or your preferred tool to run the test > > suite] > > > OPTIONAL BACKEND EXTENSIONS > > macosx: no [Mac OS-X only] > > qt5agg: no [PySide2 not found; PyQt5 not found] > > qt4agg: no [PySide not found; PyQt4 not found] > > gtk3agg: no [Requires pygobject to be installed.] > > gtk3cairo: no [Requires pygobject to be installed.] > > gtkagg: no [Requires pygtk] > > tkagg: yes [installing; run-time loading from Python Tcl / > > Tk] > > wxagg: no [requires wxPython] > > gtk: no [Requires pygtk] > > agg: yes [installing] > > cairo: yes [installing, pycairo version 1.10.0] > > windowing: no [Microsoft Windows only] > > > OPTIONAL LATEX DEPENDENCIES > > dvipng: no > > ghostscript: no > > latex: no > > pdftops: no > > > OPTIONAL PACKAGE DATA > > dlls: no [skipping due to configuration] > > > running install > > running bdist_egg > > running egg_info > > creating lib/matplotlib.egg-info > > writing requirements to lib/matplotlib.egg-info/requires.txt > > writing lib/matplotlib.egg-info/PKG-INFO > > writing namespace_packages to > lib/matplotlib.egg-info/namespace_packages.txt > > writing top-level names to lib/matplotlib.egg-info/top_level.txt > > writing dependency_links to lib/matplotlib.egg-info/dependency_links.txt > > writing manifest file 'lib/matplotlib.egg-info/SOURCES.txt' > > reading manifest file 'lib/matplotlib.egg-info/SOURCES.txt' > > reading manifest template 'MANIFEST.in' > > writing manifest file 'lib/matplotlib.egg-info/SOURCES.txt' > > installing library code to build/bdist.solaris-2.11-i86pc.64bit/egg > > running install_lib > > running build_py > > creating build > > creating build/lib.solaris-2.11-i86pc.64bit-2.7 > > copying lib/pylab.py -> build/lib.solaris-2.11-i86pc.64bit-2.7 > > creating build/lib.solaris-2.11-i86pc.64bit-2.7/matplotlib > > copying lib/matplotlib/_version.py -> > build/lib.solaris-2.11-i86pc.64bit-2.7/matplotlib > ?............ > > ?running build_ext > > building 'matplotlib.ft2font' extension > > creating build/temp.solaris-2.11-i86pc.64bit-2.7 > > creating build/temp.solaris-2.11-i86pc.64bit-2.7/src > > gcc -fno-strict-aliasing -O2 -pipe -O2 -gdwarf-2 -DHAVE_DB_185_H -pthread > -I/usr/include -I/opt/local/include -I/opt/local/include/db4 > -I/opt/local/include/ncurses -DNDEBUG -O2 -pipe -O2 -gdwarf-2 > -DHAVE_DB_185_H -pthread -I/usr/include -I/opt/local/include > -I/opt/local/include/db4 -I/opt/local/include/ncurses -fPIC > -DFREETYPE_BUILD_TYPE=system > -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API > -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION > -I/opt/local/lib/python2.7/site-packages/numpy/core/include > -I/opt/local/include/libpng16 -I/opt/local/include > -I/opt/local/include/freetype2 -I/usr/local/include -I. > -I/opt/local/include/python2.7 -c src/ft2font.cpp -o > build/temp.solaris-2.11-i86pc.64bit-2.7/src/ft2font.o > > gcc -fno-strict-aliasing -O2 -pipe -O2 -gdwarf-2 -DHAVE_DB_185_H -pthread > -I/usr/include -I/opt/local/include -I/opt/local/include/db4 > -I/opt/local/include/ncurses -DNDEBUG -O2 -pipe -O2 -gdwarf-2 > -DHAVE_DB_185_H -pthread -I/usr/include -I/opt/local/include > -I/opt/local/include/db4 -I/opt/local/include/ncurses -fPIC > -DFREETYPE_BUILD_TYPE=system > -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API > -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION > -I/opt/local/lib/python2.7/site-packages/numpy/core/include > -I/opt/local/include/libpng16 -I/opt/local/include > -I/opt/local/include/freetype2 -I/usr/local/include -I. > -I/opt/local/include/python2.7 -c src/ft2font_wrapper.cpp -o > build/temp.solaris-2.11-i86pc.64bit-2.7/src/ft2font_wrapper.o > > In file included from /opt/local/include/python2.7/Python.h:44:0, > > from src/mplutils.h:21, > > from src/ft2font_wrapper.cpp:1: > > /usr/include/unistd.h:521:75: error: declaration of C function 'void > swab(const void*, void*, ssize_t)' conflicts with > > In file included from /opt/local/include/python2.7/Python.h:42:0, > > from src/mplutils.h:21, > > from src/ft2font_wrapper.cpp:1: > > /usr/include/stdlib.h:170:13: error: previous declaration 'void swab(const > char*, char*, ssize_t)' here > > error: command 'gcc' failed with exit status 1 > > ?The error is clear, swab was declared twice in both unistd.h and stdlib.h > > # sed -n 519,522p /usr/include/unistd.h > > #if defined(_XPG4) > > /* __EXTENSIONS__ makes the SVID Third Edition prototype in stdlib.h > visible */ > > extern void swab(const void *_RESTRICT_KYWD, void *_RESTRICT_KYWD, > ssize_t); > > #endif /* defined(_XPG4) */ > > # sed -n 170p /usr/include/stdlib.h > extern void swab(const char *, char *, ssize_t);? > > > # sed -n 158,171p /usr/include/stdlib.h > > #if (defined(__EXTENSIONS__) || \ > > (!defined(_STRICT_STDC__) && !defined(_POSIX_C_SOURCE))) && \ > > (!defined(_XOPEN_SOURCE) || (defined(_XPG3) && !defined(_XPG4))) > > #ifndef _SSIZE_T > > #define _SSIZE_T > > #if defined(_LP64) || defined(_I32LPx) > > typedef long ssize_t; /* size of something in bytes or -1 */ > > #else > > typedef int ssize_t; /* (historical version) */ > > #endif > > #endif /* !_SSIZE_T */ > > > extern void swab(const char *, char *, ssize_t); > > #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */ > > > ?I saw someone has asked this question, but can't get a proper answer. > > ? > > -- > Regards > Frank Yu > _______________________________________________ > Matplotlib-devel mailing list > Matplotlib-devel at python.org > https://mail.python.org/mailman/listinfo/matplotlib-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From flyxiaoyu at gmail.com Wed Jun 22 23:07:40 2016 From: flyxiaoyu at gmail.com (Frank Yu) Date: Thu, 23 Jun 2016 11:07:40 +0800 Subject: [Matplotlib-users] [Matplotlib-devel] fail to build matplotlib on smartos(like open solaris) system In-Reply-To: References: Message-ID: Hi Thomas, Sorry for ask again, and yes, I can build c program which include 'Python.h'. I close the issues 6528 because I install it from https://pkgsrc.joyent.com/packages/SmartOS/2015Q2/x86_64/All/py27-matplotlib-1.3.1nb1.tgz. but it doesn't work well. So I try to build from source to see what happened. 2016-06-23 10:51 GMT+08:00 Thomas Caswell : > xref: https://github.com/matplotlib/matplotlib/issues/6528 which has a > more readable version of the error. > > The question I asked in the other thread still stands, can you build _any_ > c program that includes `Python.h`? > > Tom > > On Wed, Jun 22, 2016 at 10:43 PM Frank Yu wrote: > >> Hi there, >> >> I am trying build matplotlib on smartos(like open solaris) system. but >> failed with error. I am build the latest matplotlib. steps as below: >> >> >> # git describe >> >> v2.0.0b1-1699-g4b3350d >> >> # python setup.py install >> >> >> ============================================================================ >> >> Edit setup.cfg to change the build options >> >> >> BUILDING MATPLOTLIB >> >> matplotlib: yes [2.0.0b1+1699.g4b3350d] >> >> python: yes [2.7.11 (default, Jan 11 2016, 23:16:55) [GCC >> >> 4.9.3]] >> >> platform: yes [sunos5] >> >> >> REQUIRED DEPENDENCIES AND EXTENSIONS >> >> numpy: yes [version 1.11.0] >> >> six: yes [The installed version of six is 1.9.0 but a >> the >> >> minimum required version is 1.10. pip/easy install >> >> will attempt to install a newer version.] >> >> dateutil: yes [using dateutil version 2.4.0] >> >> functools32: yes [using functools32] >> >> pytz: yes [using pytz version 2014.10] >> >> cycler: yes [using cycler version 0.10.0] >> >> tornado: yes [using tornado version 4.3] >> >> pyparsing: yes [using pyparsing version 2.0.2] >> >> libagg: yes [pkg-config information for 'libagg' could not >> >> be found. Using local copy.] >> >> freetype: yes [version 2.5.5] >> >> png: yes [version 1.6.17] >> >> qhull: yes [pkg-config information for 'qhull' could not >> be >> >> found. Using local copy.] >> >> >> OPTIONAL SUBPACKAGES >> >> sample_data: yes [installing] >> >> toolkits: yes [installing] >> >> tests: yes [using nose version 1.3.7 / mock is required >> to >> >> run the matplotlib test suite. Please install it >> >> with pip or your preferred tool to run the test >> >> suite] >> >> toolkits_tests: yes [using nose version 1.3.7 / mock is required >> to >> >> run the matplotlib test suite. Please install it >> >> with pip or your preferred tool to run the test >> >> suite] >> >> >> OPTIONAL BACKEND EXTENSIONS >> >> macosx: no [Mac OS-X only] >> >> qt5agg: no [PySide2 not found; PyQt5 not found] >> >> qt4agg: no [PySide not found; PyQt4 not found] >> >> gtk3agg: no [Requires pygobject to be installed.] >> >> gtk3cairo: no [Requires pygobject to be installed.] >> >> gtkagg: no [Requires pygtk] >> >> tkagg: yes [installing; run-time loading from Python Tcl >> / >> >> Tk] >> >> wxagg: no [requires wxPython] >> >> gtk: no [Requires pygtk] >> >> agg: yes [installing] >> >> cairo: yes [installing, pycairo version 1.10.0] >> >> windowing: no [Microsoft Windows only] >> >> >> OPTIONAL LATEX DEPENDENCIES >> >> dvipng: no >> >> ghostscript: no >> >> latex: no >> >> pdftops: no >> >> >> OPTIONAL PACKAGE DATA >> >> dlls: no [skipping due to configuration] >> >> >> running install >> >> running bdist_egg >> >> running egg_info >> >> creating lib/matplotlib.egg-info >> >> writing requirements to lib/matplotlib.egg-info/requires.txt >> >> writing lib/matplotlib.egg-info/PKG-INFO >> >> writing namespace_packages to >> lib/matplotlib.egg-info/namespace_packages.txt >> >> writing top-level names to lib/matplotlib.egg-info/top_level.txt >> >> writing dependency_links to lib/matplotlib.egg-info/dependency_links.txt >> >> writing manifest file 'lib/matplotlib.egg-info/SOURCES.txt' >> >> reading manifest file 'lib/matplotlib.egg-info/SOURCES.txt' >> >> reading manifest template 'MANIFEST.in' >> >> writing manifest file 'lib/matplotlib.egg-info/SOURCES.txt' >> >> installing library code to build/bdist.solaris-2.11-i86pc.64bit/egg >> >> running install_lib >> >> running build_py >> >> creating build >> >> creating build/lib.solaris-2.11-i86pc.64bit-2.7 >> >> copying lib/pylab.py -> build/lib.solaris-2.11-i86pc.64bit-2.7 >> >> creating build/lib.solaris-2.11-i86pc.64bit-2.7/matplotlib >> >> copying lib/matplotlib/_version.py -> >> build/lib.solaris-2.11-i86pc.64bit-2.7/matplotlib >> ?............ >> >> ?running build_ext >> >> building 'matplotlib.ft2font' extension >> >> creating build/temp.solaris-2.11-i86pc.64bit-2.7 >> >> creating build/temp.solaris-2.11-i86pc.64bit-2.7/src >> >> gcc -fno-strict-aliasing -O2 -pipe -O2 -gdwarf-2 -DHAVE_DB_185_H -pthread >> -I/usr/include -I/opt/local/include -I/opt/local/include/db4 >> -I/opt/local/include/ncurses -DNDEBUG -O2 -pipe -O2 -gdwarf-2 >> -DHAVE_DB_185_H -pthread -I/usr/include -I/opt/local/include >> -I/opt/local/include/db4 -I/opt/local/include/ncurses -fPIC >> -DFREETYPE_BUILD_TYPE=system >> -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API >> -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION >> -I/opt/local/lib/python2.7/site-packages/numpy/core/include >> -I/opt/local/include/libpng16 -I/opt/local/include >> -I/opt/local/include/freetype2 -I/usr/local/include -I. >> -I/opt/local/include/python2.7 -c src/ft2font.cpp -o >> build/temp.solaris-2.11-i86pc.64bit-2.7/src/ft2font.o >> >> gcc -fno-strict-aliasing -O2 -pipe -O2 -gdwarf-2 -DHAVE_DB_185_H -pthread >> -I/usr/include -I/opt/local/include -I/opt/local/include/db4 >> -I/opt/local/include/ncurses -DNDEBUG -O2 -pipe -O2 -gdwarf-2 >> -DHAVE_DB_185_H -pthread -I/usr/include -I/opt/local/include >> -I/opt/local/include/db4 -I/opt/local/include/ncurses -fPIC >> -DFREETYPE_BUILD_TYPE=system >> -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API >> -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION >> -I/opt/local/lib/python2.7/site-packages/numpy/core/include >> -I/opt/local/include/libpng16 -I/opt/local/include >> -I/opt/local/include/freetype2 -I/usr/local/include -I. >> -I/opt/local/include/python2.7 -c src/ft2font_wrapper.cpp -o >> build/temp.solaris-2.11-i86pc.64bit-2.7/src/ft2font_wrapper.o >> >> In file included from /opt/local/include/python2.7/Python.h:44:0, >> >> from src/mplutils.h:21, >> >> from src/ft2font_wrapper.cpp:1: >> >> /usr/include/unistd.h:521:75: error: declaration of C function 'void >> swab(const void*, void*, ssize_t)' conflicts with >> >> In file included from /opt/local/include/python2.7/Python.h:42:0, >> >> from src/mplutils.h:21, >> >> from src/ft2font_wrapper.cpp:1: >> >> /usr/include/stdlib.h:170:13: error: previous declaration 'void >> swab(const char*, char*, ssize_t)' here >> >> error: command 'gcc' failed with exit status 1 >> >> ?The error is clear, swab was declared twice in both unistd.h and stdlib.h >> >> # sed -n 519,522p /usr/include/unistd.h >> >> #if defined(_XPG4) >> >> /* __EXTENSIONS__ makes the SVID Third Edition prototype in stdlib.h >> visible */ >> >> extern void swab(const void *_RESTRICT_KYWD, void *_RESTRICT_KYWD, >> ssize_t); >> >> #endif /* defined(_XPG4) */ >> >> # sed -n 170p /usr/include/stdlib.h >> extern void swab(const char *, char *, ssize_t);? >> >> >> # sed -n 158,171p /usr/include/stdlib.h >> >> #if (defined(__EXTENSIONS__) || \ >> >> (!defined(_STRICT_STDC__) && !defined(_POSIX_C_SOURCE))) && \ >> >> (!defined(_XOPEN_SOURCE) || (defined(_XPG3) && !defined(_XPG4))) >> >> #ifndef _SSIZE_T >> >> #define _SSIZE_T >> >> #if defined(_LP64) || defined(_I32LPx) >> >> typedef long ssize_t; /* size of something in bytes or -1 */ >> >> #else >> >> typedef int ssize_t; /* (historical version) */ >> >> #endif >> >> #endif /* !_SSIZE_T */ >> >> >> extern void swab(const char *, char *, ssize_t); >> >> #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */ >> >> >> ?I saw someone has asked this question, but can't get a proper answer. >> >> ? >> >> -- >> Regards >> Frank Yu >> _______________________________________________ >> Matplotlib-devel mailing list >> Matplotlib-devel at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-devel >> > -- Regards Frank Yu -------------- next part -------------- An HTML attachment was scrubbed... URL: From flyxiaoyu at gmail.com Thu Jun 23 00:47:54 2016 From: flyxiaoyu at gmail.com (Frank Yu) Date: Thu, 23 Jun 2016 12:47:54 +0800 Subject: [Matplotlib-users] [Matplotlib-devel] fail to build matplotlib on smartos(like open solaris) system In-Reply-To: References: Message-ID: Hi, I have install matplotlib after a small tweak. but when I try to run test, I met core dumped. # pip list|grep matplotlib matplotlib (2.0.0b1+1704.gf8ea2c5.dirty) # python tests.py /opt/local/lib/python2.7/site-packages/matplotlib-2.0.0b1+1704.gf8ea2c5.dirty-py2.7-solaris-2.11-i86pc.64bit.egg/matplotlib/__init__.py:1563: UserWarning: matplotlib is not built with the correct FreeType version to run tests. Set local_freetype=True in setup.cfg and rebuild. Expect many image comparison failures below. "matplotlib is not built with the correct FreeType version to run " ......KKKKKK.KK....Abort (core dumped) What I did is: # git diff diff --git a/src/mplutils.h b/src/mplutils.h index 8d4ae70..0cc9644 100644 --- a/src/mplutils.h +++ b/src/mplutils.h @@ -18,6 +18,12 @@ typedef unsigned __int8 uint8_t; # undef _XOPEN_SOURCE #endif +#if defined(__sun) || defined(sun) +#if defined(_XPG4) +#undef _XPG4 +#endif +#endif + #include #if PY_MAJOR_VERSION >= 3 diff --git a/src/numpy_cpp.h b/src/numpy_cpp.h index 887ffe4..af18b5c 100644 --- a/src/numpy_cpp.h +++ b/src/numpy_cpp.h @@ -25,6 +25,12 @@ # undef _XOPEN_SOURCE #endif +#if defined(__sun) || defined(sun) +#if defined(_XPG4) +#undef _XPG4 +#endif +#endif + #include #include 2016-06-23 11:07 GMT+08:00 Frank Yu : > Hi Thomas, > > Sorry for ask again, and yes, I can build c program which include > 'Python.h'. > I close the issues 6528 because I install it from > https://pkgsrc.joyent.com/packages/SmartOS/2015Q2/x86_64/All/py27-matplotlib-1.3.1nb1.tgz. > but it doesn't work well. So I try to build from source to see what > happened. > > > 2016-06-23 10:51 GMT+08:00 Thomas Caswell : > >> xref: https://github.com/matplotlib/matplotlib/issues/6528 which has a >> more readable version of the error. >> >> The question I asked in the other thread still stands, can you build >> _any_ c program that includes `Python.h`? >> >> Tom >> >> On Wed, Jun 22, 2016 at 10:43 PM Frank Yu wrote: >> >>> Hi there, >>> >>> I am trying build matplotlib on smartos(like open solaris) system. but >>> failed with error. I am build the latest matplotlib. steps as below: >>> >>> >>> # git describe >>> >>> v2.0.0b1-1699-g4b3350d >>> >>> # python setup.py install >>> >>> >>> ============================================================================ >>> >>> Edit setup.cfg to change the build options >>> >>> >>> BUILDING MATPLOTLIB >>> >>> matplotlib: yes [2.0.0b1+1699.g4b3350d] >>> >>> python: yes [2.7.11 (default, Jan 11 2016, 23:16:55) >>> [GCC >>> >>> 4.9.3]] >>> >>> platform: yes [sunos5] >>> >>> >>> REQUIRED DEPENDENCIES AND EXTENSIONS >>> >>> numpy: yes [version 1.11.0] >>> >>> six: yes [The installed version of six is 1.9.0 but a >>> the >>> >>> minimum required version is 1.10. pip/easy >>> install >>> >>> will attempt to install a newer version.] >>> >>> dateutil: yes [using dateutil version 2.4.0] >>> >>> functools32: yes [using functools32] >>> >>> pytz: yes [using pytz version 2014.10] >>> >>> cycler: yes [using cycler version 0.10.0] >>> >>> tornado: yes [using tornado version 4.3] >>> >>> pyparsing: yes [using pyparsing version 2.0.2] >>> >>> libagg: yes [pkg-config information for 'libagg' could >>> not >>> >>> be found. Using local copy.] >>> >>> freetype: yes [version 2.5.5] >>> >>> png: yes [version 1.6.17] >>> >>> qhull: yes [pkg-config information for 'qhull' could >>> not be >>> >>> found. Using local copy.] >>> >>> >>> OPTIONAL SUBPACKAGES >>> >>> sample_data: yes [installing] >>> >>> toolkits: yes [installing] >>> >>> tests: yes [using nose version 1.3.7 / mock is required >>> to >>> >>> run the matplotlib test suite. Please install it >>> >>> with pip or your preferred tool to run the test >>> >>> suite] >>> >>> toolkits_tests: yes [using nose version 1.3.7 / mock is required >>> to >>> >>> run the matplotlib test suite. Please install it >>> >>> with pip or your preferred tool to run the test >>> >>> suite] >>> >>> >>> OPTIONAL BACKEND EXTENSIONS >>> >>> macosx: no [Mac OS-X only] >>> >>> qt5agg: no [PySide2 not found; PyQt5 not found] >>> >>> qt4agg: no [PySide not found; PyQt4 not found] >>> >>> gtk3agg: no [Requires pygobject to be installed.] >>> >>> gtk3cairo: no [Requires pygobject to be installed.] >>> >>> gtkagg: no [Requires pygtk] >>> >>> tkagg: yes [installing; run-time loading from Python >>> Tcl / >>> >>> Tk] >>> >>> wxagg: no [requires wxPython] >>> >>> gtk: no [Requires pygtk] >>> >>> agg: yes [installing] >>> >>> cairo: yes [installing, pycairo version 1.10.0] >>> >>> windowing: no [Microsoft Windows only] >>> >>> >>> OPTIONAL LATEX DEPENDENCIES >>> >>> dvipng: no >>> >>> ghostscript: no >>> >>> latex: no >>> >>> pdftops: no >>> >>> >>> OPTIONAL PACKAGE DATA >>> >>> dlls: no [skipping due to configuration] >>> >>> >>> running install >>> >>> running bdist_egg >>> >>> running egg_info >>> >>> creating lib/matplotlib.egg-info >>> >>> writing requirements to lib/matplotlib.egg-info/requires.txt >>> >>> writing lib/matplotlib.egg-info/PKG-INFO >>> >>> writing namespace_packages to >>> lib/matplotlib.egg-info/namespace_packages.txt >>> >>> writing top-level names to lib/matplotlib.egg-info/top_level.txt >>> >>> writing dependency_links to lib/matplotlib.egg-info/dependency_links.txt >>> >>> writing manifest file 'lib/matplotlib.egg-info/SOURCES.txt' >>> >>> reading manifest file 'lib/matplotlib.egg-info/SOURCES.txt' >>> >>> reading manifest template 'MANIFEST.in' >>> >>> writing manifest file 'lib/matplotlib.egg-info/SOURCES.txt' >>> >>> installing library code to build/bdist.solaris-2.11-i86pc.64bit/egg >>> >>> running install_lib >>> >>> running build_py >>> >>> creating build >>> >>> creating build/lib.solaris-2.11-i86pc.64bit-2.7 >>> >>> copying lib/pylab.py -> build/lib.solaris-2.11-i86pc.64bit-2.7 >>> >>> creating build/lib.solaris-2.11-i86pc.64bit-2.7/matplotlib >>> >>> copying lib/matplotlib/_version.py -> >>> build/lib.solaris-2.11-i86pc.64bit-2.7/matplotlib >>> ?............ >>> >>> ?running build_ext >>> >>> building 'matplotlib.ft2font' extension >>> >>> creating build/temp.solaris-2.11-i86pc.64bit-2.7 >>> >>> creating build/temp.solaris-2.11-i86pc.64bit-2.7/src >>> >>> gcc -fno-strict-aliasing -O2 -pipe -O2 -gdwarf-2 -DHAVE_DB_185_H >>> -pthread -I/usr/include -I/opt/local/include -I/opt/local/include/db4 >>> -I/opt/local/include/ncurses -DNDEBUG -O2 -pipe -O2 -gdwarf-2 >>> -DHAVE_DB_185_H -pthread -I/usr/include -I/opt/local/include >>> -I/opt/local/include/db4 -I/opt/local/include/ncurses -fPIC >>> -DFREETYPE_BUILD_TYPE=system >>> -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API >>> -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION >>> -I/opt/local/lib/python2.7/site-packages/numpy/core/include >>> -I/opt/local/include/libpng16 -I/opt/local/include >>> -I/opt/local/include/freetype2 -I/usr/local/include -I. >>> -I/opt/local/include/python2.7 -c src/ft2font.cpp -o >>> build/temp.solaris-2.11-i86pc.64bit-2.7/src/ft2font.o >>> >>> gcc -fno-strict-aliasing -O2 -pipe -O2 -gdwarf-2 -DHAVE_DB_185_H >>> -pthread -I/usr/include -I/opt/local/include -I/opt/local/include/db4 >>> -I/opt/local/include/ncurses -DNDEBUG -O2 -pipe -O2 -gdwarf-2 >>> -DHAVE_DB_185_H -pthread -I/usr/include -I/opt/local/include >>> -I/opt/local/include/db4 -I/opt/local/include/ncurses -fPIC >>> -DFREETYPE_BUILD_TYPE=system >>> -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API >>> -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION >>> -I/opt/local/lib/python2.7/site-packages/numpy/core/include >>> -I/opt/local/include/libpng16 -I/opt/local/include >>> -I/opt/local/include/freetype2 -I/usr/local/include -I. >>> -I/opt/local/include/python2.7 -c src/ft2font_wrapper.cpp -o >>> build/temp.solaris-2.11-i86pc.64bit-2.7/src/ft2font_wrapper.o >>> >>> In file included from /opt/local/include/python2.7/Python.h:44:0, >>> >>> from src/mplutils.h:21, >>> >>> from src/ft2font_wrapper.cpp:1: >>> >>> /usr/include/unistd.h:521:75: error: declaration of C function 'void >>> swab(const void*, void*, ssize_t)' conflicts with >>> >>> In file included from /opt/local/include/python2.7/Python.h:42:0, >>> >>> from src/mplutils.h:21, >>> >>> from src/ft2font_wrapper.cpp:1: >>> >>> /usr/include/stdlib.h:170:13: error: previous declaration 'void >>> swab(const char*, char*, ssize_t)' here >>> >>> error: command 'gcc' failed with exit status 1 >>> >>> ?The error is clear, swab was declared twice in both unistd.h and >>> stdlib.h >>> >>> # sed -n 519,522p /usr/include/unistd.h >>> >>> #if defined(_XPG4) >>> >>> /* __EXTENSIONS__ makes the SVID Third Edition prototype in stdlib.h >>> visible */ >>> >>> extern void swab(const void *_RESTRICT_KYWD, void *_RESTRICT_KYWD, >>> ssize_t); >>> >>> #endif /* defined(_XPG4) */ >>> >>> # sed -n 170p /usr/include/stdlib.h >>> extern void swab(const char *, char *, ssize_t);? >>> >>> >>> # sed -n 158,171p /usr/include/stdlib.h >>> >>> #if (defined(__EXTENSIONS__) || \ >>> >>> (!defined(_STRICT_STDC__) && !defined(_POSIX_C_SOURCE))) && \ >>> >>> (!defined(_XOPEN_SOURCE) || (defined(_XPG3) && !defined(_XPG4))) >>> >>> #ifndef _SSIZE_T >>> >>> #define _SSIZE_T >>> >>> #if defined(_LP64) || defined(_I32LPx) >>> >>> typedef long ssize_t; /* size of something in bytes or -1 */ >>> >>> #else >>> >>> typedef int ssize_t; /* (historical version) */ >>> >>> #endif >>> >>> #endif /* !_SSIZE_T */ >>> >>> >>> extern void swab(const char *, char *, ssize_t); >>> >>> #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */ >>> >>> >>> ?I saw someone has asked this question, but can't get a proper answer. >>> >>> ? >>> >>> -- >>> Regards >>> Frank Yu >>> _______________________________________________ >>> Matplotlib-devel mailing list >>> Matplotlib-devel at python.org >>> https://mail.python.org/mailman/listinfo/matplotlib-devel >>> >> > > > -- > Regards > Frank Yu > -- Regards Frank Yu -------------- next part -------------- An HTML attachment was scrubbed... URL: From winash12 at gmail.com Fri Jun 24 12:51:36 2016 From: winash12 at gmail.com (ashwinD12 .) Date: Fri, 24 Jun 2016 22:21:36 +0530 Subject: [Matplotlib-users] Need clarification on shiftgrid and addcylic In-Reply-To: References: Message-ID: Thanks for your response. There was a problem with my data which made removed that error. I still have another error with shiftgrid. As per your request here are my import statements - import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap, addcyclic, shiftgrid Traceback (most recent call last): File "display.py", line 89, in hgt, lons = shiftgrid(180, hgt, lons, start = False) File "/usr/local/lib/python3.4/dist-packages/mpl_toolkits/basemap/__init__.py", line 5020, in shiftgrid raise ValueError('lon0 outside of range of lonsin') ValueError: lon0 outside of range of lonsin Here is my code - nc_f = './hgt_500_2014_12_5_00Z.nc' # Your filename nc_fid = Dataset(nc_f, 'r') # Dataset is the class behavior to open the file # and create an instance of the ncCDF4 class # Extract data from NetCDF file lats = nc_fid.variables['lat'][:] lons = nc_fid.variables['lon'][:] time = nc_fid.variables['time'][:] hgt = nc_fid.variables['hgt'][:] nc_fid.close() hgt, lons = shiftgrid(180, hgt, lons, start = False) fig = plt.figure() ax = fig.add_axes([0.1, 0.1, 0.8, 0.8]) On Wed, Jun 22, 2016 at 8:15 PM, Paul Hobson wrote: > Can you show your imports? Where did shiftgrid come from? > > On Tue, Jun 21, 2016 at 4:51 AM, ashwinD12 . wrote: > >> Hello, >> I am just starting to learn how to plot NCEP reanalysis data >> using Python3 and matplotlib and basemap. I have some clarifications on how >> to go about doing it. >> >> My dataset is between latitude 5 N to 40 N and 65 E and 100 E. >> I am trying to plot geopotential height from NCEP reanalysis data. Here >> is my code - >> >> >> level = 5 >> time = 0 >> >> meters_per_grid = 277830 >> >> d = Dataset("hgt_500_2014_12_5_00Z.nc") >> hgt = d.get_variables_by_attributes(axis="hgt") >> lon = d.get_variables_by_attributes(axis="lon") >> lat =d.get_variables_by_attributes(axis="lat") >> hgt = hgt[::-1] >> hgt, lon = shiftgrid(180, hgt, lon, start = False >> >> >> Why do I get an IndexError: index out of range on shiftgrid call ? >> >> BR, >> Ashwin. >> >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mckauf at gmail.com Tue Jun 28 14:23:19 2016 From: mckauf at gmail.com (Mike Kaufman) Date: Tue, 28 Jun 2016 14:23:19 -0400 Subject: [Matplotlib-users] poor tick locator defaults in 2.0? Message-ID: <8509ae11-db37-0381-ad77-f3786433cbcf@gmail.com> Hi, When I switched over to the 2.x branch, I found that for shorter plots (like when you have a set of vertically stacked subplots), I am seeing y-axes with only a single tick label. This is without doing any explicit tick locating. In 1.5.x I didn't see this. This is bad as it makes the whole point of labeling the ticks pointless because you can't get any sense of scale. M From ben.v.root at gmail.com Tue Jun 28 14:25:52 2016 From: ben.v.root at gmail.com (Benjamin Root) Date: Tue, 28 Jun 2016 14:25:52 -0400 Subject: [Matplotlib-users] poor tick locator defaults in 2.0? In-Reply-To: <8509ae11-db37-0381-ad77-f3786433cbcf@gmail.com> References: <8509ae11-db37-0381-ad77-f3786433cbcf@gmail.com> Message-ID: Yeah, we were experimenting with a modified ticker/autoscaling logic and we aren't too happy with it either. How fresh is your v2.x branch? I can't remember if we merged in some tweaks to the logic yet. Ben Root On Tue, Jun 28, 2016 at 2:23 PM, Mike Kaufman wrote: > Hi, > > When I switched over to the 2.x branch, I found that for shorter plots > (like when you have a set of vertically stacked subplots), I am seeing > y-axes with only a single tick label. This is without doing any explicit > tick locating. In 1.5.x I didn't see this. > > This is bad as it makes the whole point of labeling the ticks pointless > because you can't get any sense of scale. > > M > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mckauf at gmail.com Tue Jun 28 14:28:01 2016 From: mckauf at gmail.com (Mike Kaufman) Date: Tue, 28 Jun 2016 14:28:01 -0400 Subject: [Matplotlib-users] poor tick locator defaults in 2.0? In-Reply-To: References: <8509ae11-db37-0381-ad77-f3786433cbcf@gmail.com> Message-ID: <0195c898-8172-bbc8-6ac7-9855d71c4e26@gmail.com> Not too fresh. I'll update and get back to you. M On 6/28/16 2:25 PM, Benjamin Root wrote: > Yeah, we were experimenting with a modified ticker/autoscaling logic and > we aren't too happy with it either. How fresh is your v2.x branch? I > can't remember if we merged in some tweaks to the logic yet. > > Ben Root > > On Tue, Jun 28, 2016 at 2:23 PM, Mike Kaufman > wrote: > > Hi, > > When I switched over to the 2.x branch, I found that for shorter > plots (like when you have a set of vertically stacked subplots), I > am seeing y-axes with only a single tick label. This is without > doing any explicit tick locating. In 1.5.x I didn't see this. > > This is bad as it makes the whole point of labeling the ticks > pointless because you can't get any sense of scale. > > M > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > From tcaswell at gmail.com Tue Jun 28 14:28:37 2016 From: tcaswell at gmail.com (Thomas Caswell) Date: Tue, 28 Jun 2016 18:28:37 +0000 Subject: [Matplotlib-users] poor tick locator defaults in 2.0? In-Reply-To: References: <8509ae11-db37-0381-ad77-f3786433cbcf@gmail.com> Message-ID: https://github.com/matplotlib/matplotlib/pull/6584 Is the PR that should ensure that there are always at least 2 ticks. If you have that commit in you tree, can you give us an example where it fails? Tom On Tue, Jun 28, 2016 at 2:26 PM Benjamin Root wrote: > Yeah, we were experimenting with a modified ticker/autoscaling logic and > we aren't too happy with it either. How fresh is your v2.x branch? I can't > remember if we merged in some tweaks to the logic yet. > > Ben Root > > On Tue, Jun 28, 2016 at 2:23 PM, Mike Kaufman wrote: > >> Hi, >> >> When I switched over to the 2.x branch, I found that for shorter plots >> (like when you have a set of vertically stacked subplots), I am seeing >> y-axes with only a single tick label. This is without doing any explicit >> tick locating. In 1.5.x I didn't see this. >> >> This is bad as it makes the whole point of labeling the ticks pointless >> because you can't get any sense of scale. >> >> M >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Wed Jun 29 15:31:04 2016 From: tcaswell at gmail.com (Thomas Caswell) Date: Wed, 29 Jun 2016 19:31:04 +0000 Subject: [Matplotlib-users] Fwd: poor tick locator defaults in 2.0? In-Reply-To: <45b44277-e0b4-e09a-534c-a66087cc75bd@gmail.com> References: <8509ae11-db37-0381-ad77-f3786433cbcf@gmail.com> <45b44277-e0b4-e09a-534c-a66087cc75bd@gmail.com> Message-ID: Great to hear! ---------- Forwarded message --------- From: Mike Kaufman Date: Wed, Jun 29, 2016 at 3:28 PM Subject: Re: [Matplotlib-users] poor tick locator defaults in 2.0? To: Thomas Caswell , Benjamin Root Freshening up my tree fixes things. Thanks guys. M On 6/28/16 2:28 PM, Thomas Caswell wrote: > https://github.com/matplotlib/matplotlib/pull/6584 Is the PR that should > ensure that there are always at least 2 ticks. > > If you have that commit in you tree, can you give us an example where it > fails? > > Tom > > On Tue, Jun 28, 2016 at 2:26 PM Benjamin Root > wrote: > > Yeah, we were experimenting with a modified ticker/autoscaling logic > and we aren't too happy with it either. How fresh is your v2.x > branch? I can't remember if we merged in some tweaks to the logic yet. > > Ben Root > > On Tue, Jun 28, 2016 at 2:23 PM, Mike Kaufman > wrote: > > Hi, > > When I switched over to the 2.x branch, I found that for shorter > plots (like when you have a set of vertically stacked subplots), > I am seeing y-axes with only a single tick label. This is > without doing any explicit tick locating. In 1.5.x I didn't see > this. > > This is bad as it makes the whole point of labeling the ticks > pointless because you can't get any sense of scale. > > M > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jladasky at itu.edu Wed Jun 29 18:12:36 2016 From: jladasky at itu.edu (John Ladasky) Date: Wed, 29 Jun 2016 15:12:36 -0700 Subject: [Matplotlib-users] Real-time graph, redrawing a changing Y axis Message-ID: Hello everyone, Thomas Caswell has kindly directed me from the old Matplotlib-users mailing list on Sourceforge, to this address at Python.org. I submitted this post once before to this mailing list, yesterday, before I found the web page for subscribing. If a duplicate message should appear, please accept my apologies. I am using MPL 1.4.2, Python 3.4, and Ubuntu 15.04. I am developing a program which displays real-time data. On each update cycle, the graph needs to adjust the y-axis scale. I have code that mostly works, but when it re-renders the y-axis, it is not completely erasing the old one. I get tick labels written on top of each other, until everything is an unreadable smear, like this: [image: Inline image 1] Here is the relevant part of my update method: self.plot.set_data(self.x[:size], self.y[:size]) lo = self.y[:size].min() hi = self.y[:size].max() if hi - lo > 150: self.ax.set_ylim(lo-25, hi+25) else: mid = self.y[:size].mean() self.ax.set_ylim(mid-100, mid+100) self.ax.relim() self.ax.autoscale_view(None, False, True) self.ax.redraw_in_frame() # Something which erases the Y axis should go here? self.ax.get_yaxis().draw(self.parent.get_renderer()) I think that the details of setting the Y limits are unimportant, but I've included that code anyway, so that you can see my set_data() method call at the top, and you can also see that I'm continually adjusting the Y range to track the data. I think that I am searching for a method in the axis class which would erase the previously drawn tick marks and labels. So far, I haven't found one. It would replace the comment line in my code. I am trying to avoid redrawing the entire canvas on which this plot is embedded, since there are several other live data plots besides the one I have shown. The first version of my program did a full redraw, and it took over 150 milliseconds to complete an update call. That's too slow for my needs. Thanks for any help you can provide! -- *John J. Ladasky Jr., Ph.D.* *Research Scientist* *International Technological University* *2711 N. First St, San Jose, CA 95134 USA* -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: For matplotlib-users.png Type: image/png Size: 14864 bytes Desc: not available URL: From jklymak at uvic.ca Wed Jun 29 18:36:53 2016 From: jklymak at uvic.ca (Jody Klymak) Date: Wed, 29 Jun 2016 15:36:53 -0700 Subject: [Matplotlib-users] Real-time graph, redrawing a changing Y axis In-Reply-To: References: Message-ID: > On Jun 29, 2016, at 15:12 PM, John Ladasky wrote: > > I am using MPL 1.4.2, Python 3.4, and Ubuntu 15.04. I am developing a program which displays real-time data. On each update cycle, the graph needs to adjust the y-axis scale. I have code that mostly works, but when it re-renders the y-axis, it is not completely erasing the old one. I get tick labels written on top of each other, until everything is an unreadable smear, like this: I think thats because `redraw_in_frame()` doesn?t update any of the axes data? Have you looked into the animation API? Its meant for this sort of thing, and seems pretty snappy. Most of what you are doing below would just go into the `animate` function. http://matplotlib.org/examples/animation/simple_anim.html Cheers, Jody > > > > Here is the relevant part of my update method: > > self.plot.set_data(self.x[:size], self.y[:size]) > lo = self.y[:size].min() > hi = self.y[:size].max() > if hi - lo > 150: > self.ax.set_ylim(lo-25, hi+25) > else: > mid = self.y[:size].mean() > self.ax.set_ylim(mid-100, mid+100) > self.ax.relim() > self.ax.autoscale_view(None, False, True) > self.ax.redraw_in_frame() > # Something which erases the Y axis should go here? > self.ax.get_yaxis().draw(self.parent.get_renderer()) > > I think that the details of setting the Y limits are unimportant, but I've included that code anyway, so that you can see my set_data() method call at the top, and you can also see that I'm continually adjusting the Y range to track the data. > > I think that I am searching for a method in the axis class which would erase the previously drawn tick marks and labels. So far, I haven't found one. It would replace the comment line in my code. > > I am trying to avoid redrawing the entire canvas on which this plot is embedded, since there are several other live data plots besides the one I have shown. The first version of my program did a full redraw, and it took over 150 milliseconds to complete an update call. That's too slow for my needs. > > Thanks for any help you can provide! > > -- > John J. Ladasky Jr., Ph.D. > Research Scientist > International Technological University > 2711 N. First St, San Jose, CA 95134 USA > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users -------------- next part -------------- An HTML attachment was scrubbed... URL: From jladasky at itu.edu Wed Jun 29 19:23:06 2016 From: jladasky at itu.edu (John Ladasky) Date: Wed, 29 Jun 2016 16:23:06 -0700 Subject: [Matplotlib-users] Real-time graph, redrawing a changing Y axis In-Reply-To: References: Message-ID: Hi Jody, Thanks for your reply. I'm aware of Matplotlib's animation API. I'm not sure that it would help me. As far as I can tell, the purpose of animation.FuncAnimation() is to connect a data generating function to the update function of a MPL object, and to drive it all with a timer. It's an event loop, for people who aren't already writing event-driven code (which I am, I have 1,200 lines of mostly-working PyQt5). What actually gets done in the MPL update method is what I think is important to me. I want to change only what needs to be changed. My approach is best described by this article: http://bastibe.de/2013-05-30-speeding-up-matplotlib.html The article is a few years old, I know. Still, using the advice I found in articles like this one, I limited redrawing, and everything updates in under 10 milliseconds, a 15-fold improvement over my original redraw-everything approach. In total, I have five live graphs on the screen. It's only this one self-adjusting time series graph that is misbehaving for me. On Wed, Jun 29, 2016 at 3:36 PM, Jody Klymak wrote: > > On Jun 29, 2016, at 15:12 PM, John Ladasky wrote: > > I am using MPL 1.4.2, Python 3.4, and Ubuntu 15.04. I am developing a > program which displays real-time data. On each update cycle, the graph > needs to adjust the y-axis scale. I have code that mostly works, but when > it re-renders the y-axis, it is not completely erasing the old one. I get > tick labels written on top of each other, until everything is an unreadable > smear, like this: > > > I think thats because `redraw_in_frame()` doesn?t update any of the axes > data? > > Have you looked into the animation API? Its meant for this sort of thing, > and seems pretty snappy. Most of what you are doing below would just go > into the `animate` function. > > http://matplotlib.org/examples/animation/simple_anim.html > > Cheers, Jody > > > > > > > Here is the relevant part of my update method: > > self.plot.set_data(self.x[:size], self.y[:size]) > lo = self.y[:size].min() > hi = self.y[:size].max() > if hi - lo > 150: > self.ax.set_ylim(lo-25, hi+25) > else: > mid = self.y[:size].mean() > self.ax.set_ylim(mid-100, mid+100) > self.ax.relim() > self.ax.autoscale_view(None, False, True) > self.ax.redraw_in_frame() > # Something which erases the Y axis should go here? > self.ax.get_yaxis().draw(self.parent.get_renderer()) > > > I think that the details of setting the Y limits are unimportant, but I've > included that code anyway, so that you can see my set_data() method call at > the top, and you can also see that I'm continually adjusting the Y range to > track the data. > > I think that I am searching for a method in the axis class which would > erase the previously drawn tick marks and labels. So far, I haven't found > one. It would replace the comment line in my code. > > I am trying to avoid redrawing the entire canvas on which this plot is > embedded, since there are several other live data plots besides the one I > have shown. The first version of my program did a full redraw, and it took > over 150 milliseconds to complete an update call. That's too slow for my > needs. > > Thanks for any help you can provide! > > -- > *John J. Ladasky Jr., Ph.D.* > *Research Scientist* > *International Technological University* > *2711 N. First St, San Jose, CA 95134 USA* > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > > -- *John J. Ladasky Jr., Ph.D.* *Research Scientist* *International Technological University* *2711 N. First St, San Jose, CA 95134 USA* -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Wed Jun 29 21:15:05 2016 From: tcaswell at gmail.com (Thomas Caswell) Date: Thu, 30 Jun 2016 01:15:05 +0000 Subject: [Matplotlib-users] Real-time graph, redrawing a changing Y axis In-Reply-To: References: Message-ID: If you are re-computing the limits and re-drawing the yticks anyway, you are not getting much benefit from being fancy about re-drawing. You might as well do self.plot.set_data(self.x[:size], self.y[:size]) lo = self.y[:size].min() hi = self.y[:size].max() if hi - lo > 150: self.ax.set_ylim(lo-25, hi+25) else: mid = self.y[:size].mean() self.ax.set_ylim(mid-100, mid+100) self.ax.relim() self.ax.autoscale_view(None, False, True) self.ax.figure.canvas.draw_idle() which will schedule a full re-draw the next time that the GUI repaints (and requests the the GUI do so 'some time soon'). Depending on your data-rates this may allow multiple draws to be squashed into one. This assumes that each of your axes is in it's own figure. Failing that, you will have to do something like, on first draw / or resize turn off the y-ticks, use `copy_from_bbox` to grab the empty region and the use blit to restore it before drawing the next frame. You might also get away with just keeping better track of when the view limits _need_ to change and then only triggering the `draw_idle` for that. Tom On Wed, Jun 29, 2016 at 7:23 PM John Ladasky wrote: > Hi Jody, > > Thanks for your reply. I'm aware of Matplotlib's animation API. I'm not > sure that it would help me. > > As far as I can tell, the purpose of animation.FuncAnimation() is to > connect a data generating function to the update function of a MPL object, > and to drive it all with a timer. It's an event loop, for people who > aren't already writing event-driven code (which I am, I have 1,200 lines of > mostly-working PyQt5). What actually gets done in the MPL update method is > what I think is important to me. I want to change only what needs to be > changed. > > My approach is best described by this article: > > http://bastibe.de/2013-05-30-speeding-up-matplotlib.html > > The article is a few years old, I know. Still, using the advice I found > in articles like this one, I limited redrawing, and everything updates in > under 10 milliseconds, a 15-fold improvement over my original > redraw-everything approach. In total, I have five live graphs on the > screen. It's only this one self-adjusting time series graph that is > misbehaving for me. > > On Wed, Jun 29, 2016 at 3:36 PM, Jody Klymak wrote: > >> >> On Jun 29, 2016, at 15:12 PM, John Ladasky wrote: >> >> I am using MPL 1.4.2, Python 3.4, and Ubuntu 15.04. I am developing a >> program which displays real-time data. On each update cycle, the graph >> needs to adjust the y-axis scale. I have code that mostly works, but when >> it re-renders the y-axis, it is not completely erasing the old one. I get >> tick labels written on top of each other, until everything is an unreadable >> smear, like this: >> >> >> I think thats because `redraw_in_frame()` doesn?t update any of the axes >> data? >> >> Have you looked into the animation API? Its meant for this sort of >> thing, and seems pretty snappy. Most of what you are doing below would >> just go into the `animate` function. >> >> http://matplotlib.org/examples/animation/simple_anim.html >> >> Cheers, Jody >> >> >> >> >> >> >> Here is the relevant part of my update method: >> >> self.plot.set_data(self.x[:size], self.y[:size]) >> lo = self.y[:size].min() >> hi = self.y[:size].max() >> if hi - lo > 150: >> self.ax.set_ylim(lo-25, hi+25) >> else: >> mid = self.y[:size].mean() >> self.ax.set_ylim(mid-100, mid+100) >> self.ax.relim() >> self.ax.autoscale_view(None, False, True) >> self.ax.redraw_in_frame() >> # Something which erases the Y axis should go here? >> self.ax.get_yaxis().draw(self.parent.get_renderer()) >> >> >> I think that the details of setting the Y limits are unimportant, but >> I've included that code anyway, so that you can see my set_data() method >> call at the top, and you can also see that I'm continually adjusting the Y >> range to track the data. >> >> I think that I am searching for a method in the axis class which would >> erase the previously drawn tick marks and labels. So far, I haven't found >> one. It would replace the comment line in my code. >> >> I am trying to avoid redrawing the entire canvas on which this plot is >> embedded, since there are several other live data plots besides the one I >> have shown. The first version of my program did a full redraw, and it took >> over 150 milliseconds to complete an update call. That's too slow for my >> needs. >> >> Thanks for any help you can provide! >> >> -- >> *John J. Ladasky Jr., Ph.D.* >> *Research Scientist* >> *International Technological University* >> *2711 N. First St, San Jose, CA 95134 USA* >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> >> >> > > > -- > *John J. Ladasky Jr., Ph.D.* > *Research Scientist* > *International Technological University* > *2711 N. First St, San Jose, CA 95134 USA* > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jladasky at itu.edu Wed Jun 29 22:30:18 2016 From: jladasky at itu.edu (John Ladasky) Date: Wed, 29 Jun 2016 19:30:18 -0700 Subject: [Matplotlib-users] Real-time graph, redrawing a changing Y axis In-Reply-To: References: Message-ID: Hi Thomas, Thanks for your reply. self.ax.figure.canvas.draw_idle() > which will schedule a full re-draw the next time that the GUI repaints > (and requests the the GUI do so 'some time soon'). Depending on your > data-rates this may allow multiple draws to be squashed into one. This > assumes that each of your axes is in it's own figure. Alas, at least for now, each of my five axes is contained in a single Figure. I suppose that I could refactor my code and embed five separate FigureCanvas objects, each containing one axes, in my PyQt object. If, as you say, I would gain very little by getting fancy with the redrawing of this one object, that may be the way to go. I like your idea of blitting the empty region, though. Is anyone aware of any example code that shows this being done? On Wed, Jun 29, 2016 at 6:15 PM, Thomas Caswell wrote: > If you are re-computing the limits and re-drawing the yticks anyway, you > are not getting much benefit from being fancy about re-drawing. You might > as well do > > self.plot.set_data(self.x[:size], self.y[:size]) > lo = self.y[:size].min() > hi = self.y[:size].max() > if hi - lo > 150: > self.ax.set_ylim(lo-25, hi+25) > else: > mid = self.y[:size].mean() > self.ax.set_ylim(mid-100, mid+100) > self.ax.relim() > self.ax.autoscale_view(None, False, True) > self.ax.figure.canvas.draw_idle() > > which will schedule a full re-draw the next time that the GUI repaints > (and requests the the GUI do so 'some time soon'). Depending on your > data-rates this may allow multiple draws to be squashed into one. This > assumes that each of your axes is in it's own figure. > > Failing that, you will have to do something like, on first draw / or > resize turn off the y-ticks, use `copy_from_bbox` to grab the empty region > and the use blit to restore it before drawing the next frame. > > You might also get away with just keeping better track of when the view > limits _need_ to change and then only triggering the `draw_idle` for that. > > Tom > > On Wed, Jun 29, 2016 at 7:23 PM John Ladasky wrote: > >> Hi Jody, >> >> Thanks for your reply. I'm aware of Matplotlib's animation API. I'm not >> sure that it would help me. >> >> As far as I can tell, the purpose of animation.FuncAnimation() is to >> connect a data generating function to the update function of a MPL object, >> and to drive it all with a timer. It's an event loop, for people who >> aren't already writing event-driven code (which I am, I have 1,200 lines of >> mostly-working PyQt5). What actually gets done in the MPL update method is >> what I think is important to me. I want to change only what needs to be >> changed. >> >> My approach is best described by this article: >> >> http://bastibe.de/2013-05-30-speeding-up-matplotlib.html >> >> The article is a few years old, I know. Still, using the advice I found >> in articles like this one, I limited redrawing, and everything updates in >> under 10 milliseconds, a 15-fold improvement over my original >> redraw-everything approach. In total, I have five live graphs on the >> screen. It's only this one self-adjusting time series graph that is >> misbehaving for me. >> >> On Wed, Jun 29, 2016 at 3:36 PM, Jody Klymak wrote: >> >>> >>> On Jun 29, 2016, at 15:12 PM, John Ladasky wrote: >>> >>> I am using MPL 1.4.2, Python 3.4, and Ubuntu 15.04. I am developing a >>> program which displays real-time data. On each update cycle, the graph >>> needs to adjust the y-axis scale. I have code that mostly works, but when >>> it re-renders the y-axis, it is not completely erasing the old one. I get >>> tick labels written on top of each other, until everything is an unreadable >>> smear, like this: >>> >>> >>> I think thats because `redraw_in_frame()` doesn?t update any of the axes >>> data? >>> >>> Have you looked into the animation API? Its meant for this sort of >>> thing, and seems pretty snappy. Most of what you are doing below would >>> just go into the `animate` function. >>> >>> http://matplotlib.org/examples/animation/simple_anim.html >>> >>> Cheers, Jody >>> >>> >>> >>> >>> >>> >>> Here is the relevant part of my update method: >>> >>> self.plot.set_data(self.x[:size], self.y[:size]) >>> lo = self.y[:size].min() >>> hi = self.y[:size].max() >>> if hi - lo > 150: >>> self.ax.set_ylim(lo-25, hi+25) >>> else: >>> mid = self.y[:size].mean() >>> self.ax.set_ylim(mid-100, mid+100) >>> self.ax.relim() >>> self.ax.autoscale_view(None, False, True) >>> self.ax.redraw_in_frame() >>> # Something which erases the Y axis should go here? >>> self.ax.get_yaxis().draw(self.parent.get_renderer()) >>> >>> >>> I think that the details of setting the Y limits are unimportant, but >>> I've included that code anyway, so that you can see my set_data() method >>> call at the top, and you can also see that I'm continually adjusting the Y >>> range to track the data. >>> >>> I think that I am searching for a method in the axis class which would >>> erase the previously drawn tick marks and labels. So far, I haven't found >>> one. It would replace the comment line in my code. >>> >>> I am trying to avoid redrawing the entire canvas on which this plot is >>> embedded, since there are several other live data plots besides the one I >>> have shown. The first version of my program did a full redraw, and it took >>> over 150 milliseconds to complete an update call. That's too slow for my >>> needs. >>> >>> Thanks for any help you can provide! >>> >>> -- >>> *John J. Ladasky Jr., Ph.D.* >>> *Research Scientist* >>> *International Technological University* >>> *2711 N. First St, San Jose, CA 95134 USA* >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Matplotlib-users at python.org >>> https://mail.python.org/mailman/listinfo/matplotlib-users >>> >>> >>> >> >> >> -- >> *John J. Ladasky Jr., Ph.D.* >> *Research Scientist* >> *International Technological University* >> *2711 N. First St, San Jose, CA 95134 USA* >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> > -- *John J. Ladasky Jr., Ph.D.* *Research Scientist* *International Technological University* *2711 N. First St, San Jose, CA 95134 USA* -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Wed Jun 29 22:55:16 2016 From: tcaswell at gmail.com (Thomas Caswell) Date: Thu, 30 Jun 2016 02:55:16 +0000 Subject: [Matplotlib-users] Real-time graph, redrawing a changing Y axis In-Reply-To: References: Message-ID: My go-to reference for blitting is either the animation.py source or Joe Kington's answers on stackoverflow. If you go down the blitting route you have to be careful to refresh your saved canvas areas on re-size. To extend on my comment about only re-drawing when you really have to. If you mark an artist as `animated` (`art.set_animated(True)`) it will be excluded from the normal draw loop. You can then, only when you have to, trigger a full redraw (via `draw_idle` ), in a draw_event callback re-draw the ticks, and then update the artists in the axes on every new data point. Tom On Wed, Jun 29, 2016 at 10:30 PM John Ladasky wrote: > Hi Thomas, > > Thanks for your reply. > > self.ax.figure.canvas.draw_idle() >> which will schedule a full re-draw the next time that the GUI repaints >> (and requests the the GUI do so 'some time soon'). Depending on your >> data-rates this may allow multiple draws to be squashed into one. This >> assumes that each of your axes is in it's own figure. > > > Alas, at least for now, each of my five axes is contained in a single > Figure. I suppose that I could refactor my code and embed five separate > FigureCanvas objects, each containing one axes, in my PyQt object. If, as > you say, I would gain very little by getting fancy with the redrawing of > this one object, that may be the way to go. > > I like your idea of blitting the empty region, though. Is anyone aware of > any example code that shows this being done? > > On Wed, Jun 29, 2016 at 6:15 PM, Thomas Caswell > wrote: > >> If you are re-computing the limits and re-drawing the yticks anyway, you >> are not getting much benefit from being fancy about re-drawing. You might >> as well do >> >> self.plot.set_data(self.x[:size], self.y[:size]) >> lo = self.y[:size].min() >> hi = self.y[:size].max() >> if hi - lo > 150: >> self.ax.set_ylim(lo-25, hi+25) >> else: >> mid = self.y[:size].mean() >> self.ax.set_ylim(mid-100, mid+100) >> self.ax.relim() >> self.ax.autoscale_view(None, False, True) >> self.ax.figure.canvas.draw_idle() >> >> which will schedule a full re-draw the next time that the GUI repaints >> (and requests the the GUI do so 'some time soon'). Depending on your >> data-rates this may allow multiple draws to be squashed into one. This >> assumes that each of your axes is in it's own figure. >> >> Failing that, you will have to do something like, on first draw / or >> resize turn off the y-ticks, use `copy_from_bbox` to grab the empty region >> and the use blit to restore it before drawing the next frame. >> >> You might also get away with just keeping better track of when the view >> limits _need_ to change and then only triggering the `draw_idle` for that. >> >> Tom >> >> On Wed, Jun 29, 2016 at 7:23 PM John Ladasky wrote: >> >>> Hi Jody, >>> >>> Thanks for your reply. I'm aware of Matplotlib's animation API. I'm >>> not sure that it would help me. >>> >>> As far as I can tell, the purpose of animation.FuncAnimation() is to >>> connect a data generating function to the update function of a MPL object, >>> and to drive it all with a timer. It's an event loop, for people who >>> aren't already writing event-driven code (which I am, I have 1,200 lines of >>> mostly-working PyQt5). What actually gets done in the MPL update method is >>> what I think is important to me. I want to change only what needs to be >>> changed. >>> >>> My approach is best described by this article: >>> >>> http://bastibe.de/2013-05-30-speeding-up-matplotlib.html >>> >>> The article is a few years old, I know. Still, using the advice I found >>> in articles like this one, I limited redrawing, and everything updates in >>> under 10 milliseconds, a 15-fold improvement over my original >>> redraw-everything approach. In total, I have five live graphs on the >>> screen. It's only this one self-adjusting time series graph that is >>> misbehaving for me. >>> >>> On Wed, Jun 29, 2016 at 3:36 PM, Jody Klymak wrote: >>> >>>> >>>> On Jun 29, 2016, at 15:12 PM, John Ladasky wrote: >>>> >>>> I am using MPL 1.4.2, Python 3.4, and Ubuntu 15.04. I am developing a >>>> program which displays real-time data. On each update cycle, the graph >>>> needs to adjust the y-axis scale. I have code that mostly works, but when >>>> it re-renders the y-axis, it is not completely erasing the old one. I get >>>> tick labels written on top of each other, until everything is an unreadable >>>> smear, like this: >>>> >>>> >>>> I think thats because `redraw_in_frame()` doesn?t update any of the >>>> axes data? >>>> >>>> Have you looked into the animation API? Its meant for this sort of >>>> thing, and seems pretty snappy. Most of what you are doing below would >>>> just go into the `animate` function. >>>> >>>> http://matplotlib.org/examples/animation/simple_anim.html >>>> >>>> Cheers, Jody >>>> >>>> >>>> >>>> >>>> >>>> >>>> Here is the relevant part of my update method: >>>> >>>> self.plot.set_data(self.x[:size], self.y[:size]) >>>> lo = self.y[:size].min() >>>> hi = self.y[:size].max() >>>> if hi - lo > 150: >>>> self.ax.set_ylim(lo-25, hi+25) >>>> else: >>>> mid = self.y[:size].mean() >>>> self.ax.set_ylim(mid-100, mid+100) >>>> self.ax.relim() >>>> self.ax.autoscale_view(None, False, True) >>>> self.ax.redraw_in_frame() >>>> # Something which erases the Y axis should go here? >>>> self.ax.get_yaxis().draw(self.parent.get_renderer()) >>>> >>>> >>>> I think that the details of setting the Y limits are unimportant, but >>>> I've included that code anyway, so that you can see my set_data() method >>>> call at the top, and you can also see that I'm continually adjusting the Y >>>> range to track the data. >>>> >>>> I think that I am searching for a method in the axis class which would >>>> erase the previously drawn tick marks and labels. So far, I haven't found >>>> one. It would replace the comment line in my code. >>>> >>>> I am trying to avoid redrawing the entire canvas on which this plot is >>>> embedded, since there are several other live data plots besides the one I >>>> have shown. The first version of my program did a full redraw, and it took >>>> over 150 milliseconds to complete an update call. That's too slow for my >>>> needs. >>>> >>>> Thanks for any help you can provide! >>>> >>>> -- >>>> *John J. Ladasky Jr., Ph.D.* >>>> *Research Scientist* >>>> *International Technological University* >>>> *2711 N. First St, San Jose, CA 95134 USA* >>>> _______________________________________________ >>>> Matplotlib-users mailing list >>>> Matplotlib-users at python.org >>>> https://mail.python.org/mailman/listinfo/matplotlib-users >>>> >>>> >>>> >>> >>> >>> -- >>> *John J. Ladasky Jr., Ph.D.* >>> *Research Scientist* >>> *International Technological University* >>> *2711 N. First St, San Jose, CA 95134 USA* >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Matplotlib-users at python.org >>> https://mail.python.org/mailman/listinfo/matplotlib-users >>> >> > > > -- > *John J. Ladasky Jr., Ph.D.* > *Research Scientist* > *International Technological University* > *2711 N. First St, San Jose, CA 95134 USA* > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jladasky at itu.edu Wed Jun 29 23:25:12 2016 From: jladasky at itu.edu (John Ladasky) Date: Wed, 29 Jun 2016 20:25:12 -0700 Subject: [Matplotlib-users] Real-time graph, redrawing a changing Y axis In-Reply-To: References: Message-ID: I thought ahead about the window resizing problem. I can see how that might complicate the process of blitting. I fix the size of my application window and its children on initialization, and disable window resizing. On Wed, Jun 29, 2016 at 7:55 PM, Thomas Caswell wrote: > My go-to reference for blitting is either the animation.py source or Joe > Kington's answers on stackoverflow. > > If you go down the blitting route you have to be careful to refresh your > saved canvas areas on re-size. > > To extend on my comment about only re-drawing when you really have to. If > you mark an artist as `animated` (`art.set_animated(True)`) it will be > excluded from the normal draw loop. You can then, only when you have to, > trigger a full redraw (via `draw_idle` ), in a draw_event callback re-draw > the ticks, and then update the artists in the axes on every new data point. > > Tom > > > On Wed, Jun 29, 2016 at 10:30 PM John Ladasky wrote: > >> Hi Thomas, >> >> Thanks for your reply. >> >> self.ax.figure.canvas.draw_idle() >>> which will schedule a full re-draw the next time that the GUI repaints >>> (and requests the the GUI do so 'some time soon'). Depending on your >>> data-rates this may allow multiple draws to be squashed into one. This >>> assumes that each of your axes is in it's own figure. >> >> >> Alas, at least for now, each of my five axes is contained in a single >> Figure. I suppose that I could refactor my code and embed five separate >> FigureCanvas objects, each containing one axes, in my PyQt object. If, as >> you say, I would gain very little by getting fancy with the redrawing of >> this one object, that may be the way to go. >> >> I like your idea of blitting the empty region, though. Is anyone aware of >> any example code that shows this being done? >> >> On Wed, Jun 29, 2016 at 6:15 PM, Thomas Caswell >> wrote: >> >>> If you are re-computing the limits and re-drawing the yticks anyway, you >>> are not getting much benefit from being fancy about re-drawing. You might >>> as well do >>> >>> self.plot.set_data(self.x[:size], self.y[:size]) >>> lo = self.y[:size].min() >>> hi = self.y[:size].max() >>> if hi - lo > 150: >>> self.ax.set_ylim(lo-25, hi+25) >>> else: >>> mid = self.y[:size].mean() >>> self.ax.set_ylim(mid-100, mid+100) >>> self.ax.relim() >>> self.ax.autoscale_view(None, False, True) >>> self.ax.figure.canvas.draw_idle() >>> >>> which will schedule a full re-draw the next time that the GUI repaints >>> (and requests the the GUI do so 'some time soon'). Depending on your >>> data-rates this may allow multiple draws to be squashed into one. This >>> assumes that each of your axes is in it's own figure. >>> >>> Failing that, you will have to do something like, on first draw / or >>> resize turn off the y-ticks, use `copy_from_bbox` to grab the empty region >>> and the use blit to restore it before drawing the next frame. >>> >>> You might also get away with just keeping better track of when the view >>> limits _need_ to change and then only triggering the `draw_idle` for that. >>> >>> Tom >>> >>> On Wed, Jun 29, 2016 at 7:23 PM John Ladasky wrote: >>> >>>> Hi Jody, >>>> >>>> Thanks for your reply. I'm aware of Matplotlib's animation API. I'm >>>> not sure that it would help me. >>>> >>>> As far as I can tell, the purpose of animation.FuncAnimation() is to >>>> connect a data generating function to the update function of a MPL object, >>>> and to drive it all with a timer. It's an event loop, for people who >>>> aren't already writing event-driven code (which I am, I have 1,200 lines of >>>> mostly-working PyQt5). What actually gets done in the MPL update method is >>>> what I think is important to me. I want to change only what needs to be >>>> changed. >>>> >>>> My approach is best described by this article: >>>> >>>> http://bastibe.de/2013-05-30-speeding-up-matplotlib.html >>>> >>>> The article is a few years old, I know. Still, using the advice I >>>> found in articles like this one, I limited redrawing, and everything >>>> updates in under 10 milliseconds, a 15-fold improvement over my original >>>> redraw-everything approach. In total, I have five live graphs on the >>>> screen. It's only this one self-adjusting time series graph that is >>>> misbehaving for me. >>>> >>>> On Wed, Jun 29, 2016 at 3:36 PM, Jody Klymak wrote: >>>> >>>>> >>>>> On Jun 29, 2016, at 15:12 PM, John Ladasky wrote: >>>>> >>>>> I am using MPL 1.4.2, Python 3.4, and Ubuntu 15.04. I am developing a >>>>> program which displays real-time data. On each update cycle, the graph >>>>> needs to adjust the y-axis scale. I have code that mostly works, but when >>>>> it re-renders the y-axis, it is not completely erasing the old one. I get >>>>> tick labels written on top of each other, until everything is an unreadable >>>>> smear, like this: >>>>> >>>>> >>>>> I think thats because `redraw_in_frame()` doesn?t update any of the >>>>> axes data? >>>>> >>>>> Have you looked into the animation API? Its meant for this sort of >>>>> thing, and seems pretty snappy. Most of what you are doing below would >>>>> just go into the `animate` function. >>>>> >>>>> http://matplotlib.org/examples/animation/simple_anim.html >>>>> >>>>> Cheers, Jody >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> Here is the relevant part of my update method: >>>>> >>>>> self.plot.set_data(self.x[:size], self.y[:size]) >>>>> lo = self.y[:size].min() >>>>> hi = self.y[:size].max() >>>>> if hi - lo > 150: >>>>> self.ax.set_ylim(lo-25, hi+25) >>>>> else: >>>>> mid = self.y[:size].mean() >>>>> self.ax.set_ylim(mid-100, mid+100) >>>>> self.ax.relim() >>>>> self.ax.autoscale_view(None, False, True) >>>>> self.ax.redraw_in_frame() >>>>> # Something which erases the Y axis should go here? >>>>> self.ax.get_yaxis().draw(self.parent.get_renderer()) >>>>> >>>>> >>>>> I think that the details of setting the Y limits are unimportant, but >>>>> I've included that code anyway, so that you can see my set_data() method >>>>> call at the top, and you can also see that I'm continually adjusting the Y >>>>> range to track the data. >>>>> >>>>> I think that I am searching for a method in the axis class which would >>>>> erase the previously drawn tick marks and labels. So far, I haven't found >>>>> one. It would replace the comment line in my code. >>>>> >>>>> I am trying to avoid redrawing the entire canvas on which this plot is >>>>> embedded, since there are several other live data plots besides the one I >>>>> have shown. The first version of my program did a full redraw, and it took >>>>> over 150 milliseconds to complete an update call. That's too slow for my >>>>> needs. >>>>> >>>>> Thanks for any help you can provide! >>>>> >>>>> -- >>>>> *John J. Ladasky Jr., Ph.D.* >>>>> *Research Scientist* >>>>> *International Technological University* >>>>> *2711 N. First St, San Jose, CA 95134 USA* >>>>> _______________________________________________ >>>>> Matplotlib-users mailing list >>>>> Matplotlib-users at python.org >>>>> https://mail.python.org/mailman/listinfo/matplotlib-users >>>>> >>>>> >>>>> >>>> >>>> >>>> -- >>>> *John J. Ladasky Jr., Ph.D.* >>>> *Research Scientist* >>>> *International Technological University* >>>> *2711 N. First St, San Jose, CA 95134 USA* >>>> _______________________________________________ >>>> Matplotlib-users mailing list >>>> Matplotlib-users at python.org >>>> https://mail.python.org/mailman/listinfo/matplotlib-users >>>> >>> >> >> >> -- >> *John J. Ladasky Jr., Ph.D.* >> *Research Scientist* >> *International Technological University* >> *2711 N. First St, San Jose, CA 95134 USA* >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> > -- *John J. Ladasky Jr., Ph.D.* *Research Scientist* *International Technological University* *2711 N. First St, San Jose, CA 95134 USA* -------------- next part -------------- An HTML attachment was scrubbed... URL: