From tcaswell at gmail.com Tue May 2 22:59:04 2017 From: tcaswell at gmail.com (Thomas Caswell) Date: Wed, 03 May 2017 02:59:04 +0000 Subject: [Matplotlib-users] [REL] Matplotlib v2.0.1 In-Reply-To: References: Message-ID: Folks, Happy to announce the only slightly delayed release of 2.0.1, the first bug fix release for 2.0.x series. Source and wheels are an pypi and conda packages are available from the conda forge channel pip install --upgrade matplotlib or conda install matplotlib -c conda-forge This release includes bug fixes, documentation updates and one major change. API - Do not clip the linewidth used for dash pattern scaling. This is an API change, but is a major improvement. - Deprecate 'vega' color names in favor of 'tab'. Bug Fixes - Hatching color follows edge color again. - Fixes a critical bug with masked images. - Improved high-dpi support for Qt5. - Log ticking no never skip minor ticks - Do not skip points surrounded by nan/inf in vector outputs. Supported versions of Python - 2.7, 3.4, 3.5, 3.6 - Patches to improve compatibility with pypy Many thanks to everyone who helped with this release! Thanks to Mathew Brett and Christoph Gohlke for building the wheels. Tom -------------- next part -------------- An HTML attachment was scrubbed... URL: From ndbecker2 at gmail.com Wed May 3 10:08:09 2017 From: ndbecker2 at gmail.com (Neal Becker) Date: Wed, 03 May 2017 10:08:09 -0400 Subject: [Matplotlib-users] [REL] Matplotlib v2.0.1 seems to break Qt4Agg References: Message-ID: https://github.com/matplotlib/matplotlib/issues/8563 From tcaswell at gmail.com Wed May 3 10:12:51 2017 From: tcaswell at gmail.com (Thomas Caswell) Date: Wed, 03 May 2017 14:12:51 +0000 Subject: [Matplotlib-users] [REL] Matplotlib v2.0.1 seems to break Qt4Agg In-Reply-To: References: Message-ID: This has already been fixed on 2.0.x ( https://github.com/matplotlib/matplotlib/pull/8559). A 2.0.2 release will be coming shortly, going to give it a few days to see if there is anything else that should be fixed asap. Sorry about this (I put the broken code in). Tom On Wed, May 3, 2017 at 10:09 AM Neal Becker wrote: > https://github.com/matplotlib/matplotlib/issues/8563 > > _______________________________________________ > 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 matplotlib at 2sn.net Wed May 3 10:56:02 2017 From: matplotlib at 2sn.net (Alexander Heger) Date: Wed, 3 May 2017 16:56:02 +0200 Subject: [Matplotlib-users] [REL] Matplotlib v2.0.1 In-Reply-To: References: Message-ID: as I think has been noticed, the hatch colour in the legend is still broken. On 03/05/17 04:59, Thomas Caswell wrote: > Folks, > > Happy to announce the only slightly delayed release of 2.0.1, the first > bug fix release for 2.0.x series. Source and wheels are an pypi and > conda packages are available from the conda forge channel > > pip install --upgrade matplotlib > > or > > conda install matplotlib -c conda-forge > > > This release includes bug fixes, documentation updates and one major change. > > API > > - Do not clip the linewidth used for dash pattern scaling. This is > an API change, but is a major improvement. > - Deprecate 'vega' color names in favor of 'tab'. > > Bug Fixes > > - Hatching color follows edge color again. > - Fixes a critical bug with masked images. > - Improved high-dpi support for Qt5. > - Log ticking no never skip minor ticks > - Do not skip points surrounded by nan/inf in vector outputs. > > Supported versions of Python > > - 2.7, 3.4, 3.5, 3.6 > - Patches to improve compatibility with pypy > > Many thanks to everyone who helped with this release! > > Thanks to Mathew Brett and Christoph Gohlke for building the wheels. > > Tom > > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > From jslavin at cfa.harvard.edu Fri May 5 11:03:56 2017 From: jslavin at cfa.harvard.edu (Slavin, Jonathan) Date: Fri, 5 May 2017 11:03:56 -0400 Subject: [Matplotlib-users] using different backends for python 2.7 and 3.6 Message-ID: Hi, I'm starting to make the transition from python 2.7.x to python 3.x (currently 3.6). I've found that for my python 3.6 installation (via conda), the Qt4Agg backend doesn't work, but Qt5Agg does. On the other hand, for python 2.7, Qt4Agg works, but Qt5Agg doesn't. Of course it would be best if these issues were fixed (and there appear to be bug reports on this) but until that happens, is there a recommended way to set the backend other than editing the matplotlibrc file. I tried setting the MPLBACKEND environment variable, but that didn't seem to work. I like using ipython --pylab, especially for quick plotting. I know I could start ipython and then do import matplotlib matplotlib.use("Qt5Agg") ?etc., but that's kind of a pain. Suggestions welcome. Regards, Jon? -- ________________________________________________________ Jonathan D. Slavin Harvard-Smithsonian CfA jslavin at cfa.harvard.edu 60 Garden Street, MS 83 phone: (617) 496-7981 Cambridge, MA 02138-1516 cell: (781) 363-0035 USA ________________________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: From nathan12343 at gmail.com Fri May 5 11:10:02 2017 From: nathan12343 at gmail.com (Nathan Goldbaum) Date: Fri, 5 May 2017 10:10:02 -0500 Subject: [Matplotlib-users] using different backends for python 2.7 and 3.6 In-Reply-To: References: Message-ID: You could sniff the python version in your IPython startup file. On Fri, May 5, 2017 at 10:03 AM, Slavin, Jonathan wrote: > Hi, > > I'm starting to make the transition from python 2.7.x to python 3.x > (currently 3.6). I've found that for my python 3.6 installation (via > conda), the Qt4Agg backend doesn't work, but Qt5Agg does. On the other > hand, for python 2.7, Qt4Agg works, but Qt5Agg doesn't. Of course it would > be best if these issues were fixed (and there appear to be bug reports on > this) but until that happens, is there a recommended way to set the backend > other than editing the matplotlibrc file. I tried setting the MPLBACKEND > environment variable, but that didn't seem to work. I like using ipython > --pylab, especially for quick plotting. I know I could start ipython and > then do > import matplotlib > matplotlib.use("Qt5Agg") > ?etc., but that's kind of a pain. Suggestions welcome. > > Regards, > Jon? > > -- > ________________________________________________________ > Jonathan D. Slavin Harvard-Smithsonian CfA > jslavin at cfa.harvard.edu 60 Garden Street, MS 83 > phone: (617) 496-7981 Cambridge, MA 02138-1516 > cell: (781) 363-0035 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 tcaswell at gmail.com Wed May 10 17:14:06 2017 From: tcaswell at gmail.com (Thomas Caswell) Date: Wed, 10 May 2017 21:14:06 +0000 Subject: [Matplotlib-users] [ANN] Matplotlib v2.0.2 Message-ID: Folks, Happy to announce Matplotlib 2.0.2 which fixes a number of critical bugs in 2.0.1. Wheels and source are available on pypi and conda packages from the conda-forge channel pip install --upgrade matplotlib conda install matplotlib -c conda-forge Tom -------------- next part -------------- An HTML attachment was scrubbed... URL: From noflaco at gmail.com Sat May 13 05:50:54 2017 From: noflaco at gmail.com (Carlton Banks) Date: Sat, 13 May 2017 11:50:54 +0200 Subject: [Matplotlib-users] How do i store plot data as numpy ndarray.. Message-ID: Hi guys.. I seem to have a problems with converting my plot to a numpy ndarray - Such that if I made a imshow of the numpy ndarray i would see am image similar to the lmage i created.. librosa.display.specshow(static.T,sr=16000,x_axis='frames',y_axis='mel',hop_length=160,cmap=cm.jet) plt.title("log mel power spectrum of " + name) plt.colorbar(format='%+02.0f dB') plt.tight_layout() plt.savefig(plot+"/"+name+"_plot_static_conv.png") plt.show() This will show an image such as: But if i try to store it as a numpy ndarray and then trying to plot it using this code convert = plt.get_cmap(cm.jet) numpy_output_static = convert(static.T) plt.imshow(numpy_output_static) plt.show() raw_input("sadas") I see something like this -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: JPR6G.png Type: image/png Size: 82582 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 2WGgJ.png Type: image/png Size: 9306 bytes Desc: not available URL: From noflaco at gmail.com Sat May 13 07:52:17 2017 From: noflaco at gmail.com (Carlton Banks) Date: Sat, 13 May 2017 13:52:17 +0200 Subject: [Matplotlib-users] How do i store plot data as numpy ndarray.. In-Reply-To: References: Message-ID: <56EA1FCC-54CE-4C15-8DEB-880DDE70FE13@gmail.com> I made this tiny example code for reproducing the output: import numpy as np import matplotlib.pyplot as plt import matplotlib from PIL import Image import librosa import librosa.display from matplotlib import cm fig = plt.figure(figsize=(12,4)) min = -1.828067 max = 22.70058 data = np.random.uniform(low=min, high=max, size=(474,40)) librosa.display.specshow(data.T,sr=16000,x_axis='frames',y_axis='mel',hop_length=160,cmap=cm.jet) plt.show() raw_input("sadas") convert = plt.get_cmap(cm.jet) numpy_output_static = convert(data.T) plt.imshow(numpy_output_static, aspect = 'auto') plt.show() raw_input("asds") Which gives two different images, a random plot in first one, and a red plot in the second one. > Den 13. maj 2017 kl. 11.50 skrev Carlton Banks : > > Hi guys.. > > I seem to have a problems with converting my plot to a numpy ndarray - > Such that if I made a imshow of the numpy ndarray i would see am image similar to the lmage i created.. > > librosa.display.specshow(static.T,sr=16000,x_axis='frames',y_axis='mel',hop_length=160,cmap=cm.jet) > plt.title("log mel power spectrum of " + name) > plt.colorbar(format='%+02.0f dB') > plt.tight_layout() > plt.savefig(plot+"/"+name+"_plot_static_conv.png") > plt.show() > This will show an image such as: > > > > But if i try to store it as a numpy ndarray and then trying to plot it using this code > convert = plt.get_cmap(cm.jet) > numpy_output_static = convert(static.T) > plt.imshow(numpy_output_static) > plt.show() > raw_input("sadas") > I see something like this <2WGgJ.png> -------------- next part -------------- An HTML attachment was scrubbed... URL: From vincent.adrien at gmail.com Mon May 15 02:33:41 2017 From: vincent.adrien at gmail.com (vincent.adrien at gmail.com) Date: Mon, 15 May 2017 08:33:41 +0200 Subject: [Matplotlib-users] How do i store plot data as numpy ndarray.. In-Reply-To: <56EA1FCC-54CE-4C15-8DEB-880DDE70FE13@gmail.com> References: <56EA1FCC-54CE-4C15-8DEB-880DDE70FE13@gmail.com> Message-ID: <179c3760-6b4e-3605-9a21-4bf203185a92@gmail.com> Hi, I think the problem is that you do not actually retrieve the plotted array data with `matplotlib.pyplot.get_cmap` but the `matplotlib.colormap.Colormap` instance instead (i.e. just the color <-> value mapping). Please see the following code snippet to achieve something that looks like you want if I understood correctly your wish. ```python import matplotlib.pyplot as plt import numpy as np original_data = np.arange(600).reshape((200, -1)) im_opts = {'aspect': 'auto', 'cmap': 'viridis'} fig, (ax0, ax1) = plt.subplots(ncols=2) ax0.set_title('From Original Data') im0 = ax0.imshow(original_data, **im_opts) # NB: ``get_array`` returns a masked array from `numpy.ma`. More information: # https://docs.scipy.org/doc/numpy/reference/maskedarray.generic.html masked_data = im0.get_array() np.save('recorded_array.npy', masked_data.data) # NB: use the mask if needed reloaded_data = np.load('recorded_array.npy') ax1.set_title('From Recorded Data') im1 = ax1.imshow(reloaded_data, **im_opts) # just to be sure :) np.testing.assert_allclose(original_data, reloaded_data) plt.show() ``` Best regards, Adrien V. Le 13/05/2017 ? 13:52, Carlton Banks a ?crit : > I made this tiny example code for reproducing the output: > > |importnumpy asnp importmatplotlib.pyplot asplt importmatplotlib fromPIL > importImageimportlibrosa importlibrosa.display frommatplotlib importcm fig > =plt.figure(figsize=(12,4))min =-1.828067max =22.70058data > =np.random.uniform(low=min,high=max,size=(474,40))librosa.display.specshow(data.T,sr=16000,x_axis='frames',y_axis='mel',hop_length=160,cmap=cm.jet)plt.show()raw_input("sadas")convert > =plt.get_cmap(cm.jet)numpy_output_static > =convert(data.T)plt.imshow(numpy_output_static,aspect > ='auto')plt.show()raw_input("asds")| > > > Which gives two different images, a random plot in first one, and a red plot in > the second one. >> Den 13. maj 2017 kl. 11.50 skrev Carlton Banks > >: >> >> Hi guys.. >> >> I seem to have a problems with converting my plot to a numpy ndarray - >> Such that if I made a imshow of the numpy ndarray i would see am image similar >> to the lmage i created.. >> >> |librosa.display.specshow(static.T,sr=16000,x_axis='frames',y_axis='mel',hop_length=160,cmap=cm.jet)plt.title("log >> mel power spectrum of "+name)plt.colorbar(format='%+02.0f >> dB')plt.tight_layout()plt.savefig(plot+"/"+name+"_plot_static_conv.png")plt.show()| >> This will show an image such as: >> >> >> >> But if i try to store it as a numpy ndarray and then trying to plot it using >> this code >> |convert =plt.get_cmap(cm.jet)numpy_output_static >> =convert(static.T)plt.imshow(numpy_output_static)plt.show()raw_input("sadas")| >> I see something like this <2WGgJ.png> > > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > From vincent.adrien at gmail.com Mon May 15 03:16:46 2017 From: vincent.adrien at gmail.com (vincent.adrien at gmail.com) Date: Mon, 15 May 2017 09:16:46 +0200 Subject: [Matplotlib-users] How do i store plot data as numpy ndarray.. In-Reply-To: <56EA1FCC-54CE-4C15-8DEB-880DDE70FE13@gmail.com> References: <56EA1FCC-54CE-4C15-8DEB-880DDE70FE13@gmail.com> Message-ID: <9e0c7502-efed-e2c1-6360-48c1d928415b@gmail.com> I am not an expert in Numpy masked array, but if I am correct, you can access the data array of a masked array `m_arr` with no masking through the `m_arr.data` attribute, the boolean mask through the `m_arr.mask` one and the masked array through something like `m_arr[~m_arr.mask]`. This way, you can retrieve the data that is actually displayed by imshow, can't you? If you absolutely need to save the mask too with Numpy, I would suggest to use `numpy.savez` (note the ending z) to record both the data array and the boolean mask. With similar notations as in the previous code snippet, this may looks like: ```python masked_data = im0.get_array() np.savez('full_data.npz', data=masked_data.data, mask=masked_data.mask) with np.load('test.npz') as f: reloaded_data = f['data'] reloaded_mask = f['mask'] reloaded_ma = np.ma.MaskedArray(reloaded_data, mask=reloaded_mask) ax1.imshow(reloaded_ma, **im_opts) ``` Best, Adrien V. Le 13/05/2017 ? 13:52, Carlton Banks a ?crit : > I made this tiny example code for reproducing the output: > > |importnumpy asnp importmatplotlib.pyplot asplt importmatplotlib fromPIL > importImageimportlibrosa importlibrosa.display frommatplotlib importcm fig > =plt.figure(figsize=(12,4))min =-1.828067max =22.70058data > =np.random.uniform(low=min,high=max,size=(474,40))librosa.display.specshow(data.T,sr=16000,x_axis='frames',y_axis='mel',hop_length=160,cmap=cm.jet)plt.show()raw_input("sadas")convert > =plt.get_cmap(cm.jet)numpy_output_static > =convert(data.T)plt.imshow(numpy_output_static,aspect > ='auto')plt.show()raw_input("asds")| > > > Which gives two different images, a random plot in first one, and a red plot in > the second one. >> Den 13. maj 2017 kl. 11.50 skrev Carlton Banks > >: >> >> Hi guys.. >> >> I seem to have a problems with converting my plot to a numpy ndarray - >> Such that if I made a imshow of the numpy ndarray i would see am image similar >> to the lmage i created.. >> >> |librosa.display.specshow(static.T,sr=16000,x_axis='frames',y_axis='mel',hop_length=160,cmap=cm.jet)plt.title("log >> mel power spectrum of "+name)plt.colorbar(format='%+02.0f >> dB')plt.tight_layout()plt.savefig(plot+"/"+name+"_plot_static_conv.png")plt.show()| >> This will show an image such as: >> >> >> >> But if i try to store it as a numpy ndarray and then trying to plot it using >> this code >> |convert =plt.get_cmap(cm.jet)numpy_output_static >> =convert(static.T)plt.imshow(numpy_output_static)plt.show()raw_input("sadas")| >> I see something like this <2WGgJ.png> > > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > From jni.soma at gmail.com Mon May 15 03:25:54 2017 From: jni.soma at gmail.com (Juan Nunez-Iglesias) Date: Mon, 15 May 2017 17:25:54 +1000 Subject: [Matplotlib-users] Subplot x-axis shared with other subplots y-axis Message-ID: Hello, I?m trying to build an orthogonal-views volume viewer in Matplotlib like this one: https://imagej.nih.gov/ij/docs/guide/images/OrthogonalViews.png For this to work, I need to share the y-axis of the YZ (right) view/subplot with the x-axis of the XZ (bottom) view/subplot. Is this possible? Juan. -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Mon May 15 11:43:18 2017 From: tcaswell at gmail.com (Thomas Caswell) Date: Mon, 15 May 2017 15:43:18 +0000 Subject: [Matplotlib-users] Subplot x-axis shared with other subplots y-axis In-Reply-To: References: Message-ID: There are callbacks that fire when the limits are changed. See https://matplotlib.org/examples/event_handling/viewlims.html for an example. This is probably the best route to go down as you can do other interesting things as the event goes by (like triggering computation, updating a openGL view window, etc) as well as updating the Matplotlib limits. Tom On Mon, May 15, 2017 at 3:29 AM Juan Nunez-Iglesias wrote: > Hello, > > I?m trying to build an orthogonal-views volume viewer in Matplotlib like > this one: > https://imagej.nih.gov/ij/docs/guide/images/OrthogonalViews.png > > For this to work, I need to share the y-axis of the YZ (right) > view/subplot with the x-axis of the XZ (bottom) view/subplot. Is this > possible? > > 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 kaue.sena at usp.br Sun May 28 16:34:22 2017 From: kaue.sena at usp.br (=?UTF-8?Q?Kau=C3=AA_da_Silva_Sena?=) Date: Sun, 28 May 2017 17:34:22 -0300 Subject: [Matplotlib-users] Changing font Message-ID: I've set rc('text', usetex=True) following the instructions of this link: https://matplotlib.org/users/usetex.html#usetex-with-unicode Now I'd like to set the default font of my graphs as Utopia. But it seems that it is not possible through the usual rc parameter settings as said in this piece of text from the link: http://matplotlib.org/users/customizing.html #text.usetex : False # use latex for all text handling. The following fonts # are supported through the usual rc parameter settings: # new century schoolbook, bookman, times, palatino, # zapf chancery, charter, serif, sans-serif, helvetica, # avant garde, courier, monospace, computer modern roman, # computer modern sans serif, computer modern typewriter # If another font is desired which can loaded using the # LaTeX \usepackage command, please inquire at the # matplotlib mailing list This font is said to be available. #font.serif : DejaVu Serif, Bitstream Vera Serif, New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif I would apreciate to learn how to make this work. Kau? -------------- next part -------------- An HTML attachment was scrubbed... URL: From djpine at gmail.com Sun May 7 13:45:20 2017 From: djpine at gmail.com (David J Pine) Date: Sun, 07 May 2017 17:45:20 -0000 Subject: [Matplotlib-users] figsize wrong in Qt5Agg import Message-ID: Using the qt5agg backend, I get plots that are 2 times too small unless I use pyplot. I just upgraded to matplotlib 2.01. I'm running on a Mac using the Anaconda installation: 4.3.17 py36_0 This two scripts produce plots that are the same size. Why do I have to double the figsize parameters when I do not use pyplot? Seems like a bug. I didn't need to do this for the Qt4Agg backend. # script 1 import matplotlib matplotlib.use('Qt5Agg') import matplotlib.pyplot as plt fig1, ax = plt.subplots(figsize=(6, 4)) ax.plot([1, 2, 3, 2, 3, 4, 3, 4, 5]) ax.set_title('A simple plot') ax.grid(True) ax.set_xlabel('time') ax.set_ylabel('volts') plt.savefig('test1.pdf') plt.show() # script 2 import matplotlib matplotlib.use('Qt5Agg') from matplotlib.backends.backend_qt5agg \ import FigureCanvasQTAgg as FigureCanvas from matplotlib.figure import Figure fig = Figure(figsize=(12, 8)) canvas = FigureCanvas(fig) ax = fig.add_subplot(111) ax.plot([1, 2, 3, 2, 3, 4, 3, 4, 5]) ax.set_title('A simple plot') ax.grid(True) ax.set_xlabel('time') ax.set_ylabel('volts') canvas.print_figure('test2.pdf') canvas.show() -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefanschubi at googlemail.com Thu May 11 01:17:59 2017 From: stefanschubi at googlemail.com (stefanxfg) Date: Thu, 11 May 2017 05:17:59 -0000 Subject: [Matplotlib-users] Embedding, Drawing, Curser in Tkinter Message-ID: <1494479878318-48038.post@n5.nabble.com> Hello to everyone. I develop a GUI and i want to embedd Matplotlib in a Tkinter Canvas. Theres is no problem until here. But i want to draw the lines and have a curser line in the diagram. In the code below i embedd the canvas in the INIT-Function. class BOStrab_Fahrzeugeinschraenkung: def __init__(self, top=None): ...... self.ya = np.array(ddd) self.yb = np.array(ddd) self.z = np.array(ddd) self.canvasframe11 = Frame(self.TPanedwindow4_f2) self.canvasframe11.place(x=0, y=0, relwidth=1.0, relheight=0.95, bordermode=INSIDE) self.canvasframe12 = Frame(self.TPanedwindow4_f2) self.canvasframe12.place(x=0, rely=0.95, relwidth=1.0, bordermode=INSIDE) global ax1 self.fig1 = Figure (figsize=(5,4), dpi=100) self.ax1 = self.fig1.add_subplot(111) #f?r 2d-Plot self.ax1.set_title('Definition der LRUGL') self.ax1.set_xlabel('Breite y [mm]') self.ax1.set_ylabel('Hoehe z [mm]') self.ax1.axis([-2000,2000,0, 5000]) self.ax1.grid(True) self.ax1.plot(self.ya,self.z, color='red', linestyle='--', marker='') self.ax1.plot(self.yb,self.z, color='red', linestyle='--', marker='') self.canvas1 = FigureCanvasTkAgg(self.fig1,self.canvasframe11) toolbar1 = NavigationToolbar2TkAgg(self.canvas1, self.canvasframe12) self.canvas1.get_tk_widget().pack(fill=BOTH, expand=TRUE, pady=2, padx=2, anchor="n") In several examples i saw the drawing in def's and the input for the drawing from root. So the following code is function then. def onMouseMove(event): ax1.lines = [ax1.lines[0]] ax1.axhline(y=event.ydata, color="k") ax1.axvline(x=event.xdata, color="k") def updateData(): global level1, val1 clamp = lambda n, minn, maxn: max(min(maxn, n), minn) yield 1 # FuncAnimation expects an iterator def visualize(i): lineVal1.set_ydata(val1) return lineVal1 My question is. Is my way to embedd the code in Tkinter right? Or its better to declare the diagram functionalities outside the class and only draw into the class? Best regards from Stefan -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Embedding-Drawing-Curser-in-Tkinter-tp48038.html Sent from the matplotlib - users mailing list archive at Nabble.com. From pierre.garcia at etu.univ-lyon1.fr Thu May 11 07:27:02 2017 From: pierre.garcia at etu.univ-lyon1.fr (GARCIA PIERRE SIMON p0904379) Date: Thu, 11 May 2017 11:27:02 -0000 Subject: [Matplotlib-users] Problem of memory leak using FigureCanvasTkAgg Message-ID: <1494500114526.97210@etu.univ-lyon1.fr> Hello, I'm PhD student in Bioinformatic and I'm working on a project using matplotlib and Tkinter but I've got a big problem of memory leak using these modules. I'll be very grateful if you could help me to solve this problem. Here is the link explaining what happends, with a reduced script: http://stackoverflow.com/questions/43097378/matplotlib-vs-tkinter-memory-leak-using-figurecanvastkagg Thank you in advance, Sincerly, Pierre Garcia, PhD Student --------- Bases Mol?culaires et Structurales des Syst?mes infectieux-UMR5086 Institut de Biologie et Chimie des Prot?ines 7 passage du Vercors 69 367 Lyon cedex 07 --------- Laboratoire de Biom?trie et Biologie Evolutive-UMR5558 UCBL Lyon 1 -B?t. Gr?gory Mendel 43 bd du 11 novembre 1918 69622 VILLEURBANNE cedex -------------- next part -------------- An HTML attachment was scrubbed... URL: From R.Tap at marin.nl Tue May 16 07:50:52 2017 From: R.Tap at marin.nl (Tap, Frank) Date: Tue, 16 May 2017 11:50:52 -0000 Subject: [Matplotlib-users] Polygon Selector Demo Message-ID: Dear all, I try to run the Polygon Selector Demo (https://matplotlib.org/devdocs/gallery/widgets/polygon_selector_demo.html#sphx-glr-gallery-widgets-polygon-selector-demo-py) but I get the following error: ImportError: cannot import name PolygonSelector I am using matplotlib 2.0.2. Can anybody please tell me what I?m doing wrong? Regards, Frank dr. ir. Frank Tap | Software Engineer | Maritime Simulation & Software Group MARIN | T +31 317 49 32 11 | r.tap at marin.nl | www.marin.nl [LinkedIn] [YouTube] [Twitter] [Facebook] MARIN news: ?Hydrodynamics of Floating Offshore Structures? course, Singapore & Houston -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image015328.PNG Type: image/png Size: 293 bytes Desc: image015328.PNG URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image25c33d.PNG Type: image/png Size: 331 bytes Desc: image25c33d.PNG URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image4098a9.PNG Type: image/png Size: 333 bytes Desc: image4098a9.PNG URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image371909.PNG Type: image/png Size: 253 bytes Desc: image371909.PNG URL: From poojabhalode11 at gmail.com Wed May 17 10:05:56 2017 From: poojabhalode11 at gmail.com (Pooja) Date: Wed, 17 May 2017 14:05:56 -0000 Subject: [Matplotlib-users] Matplotlib tkinter error Message-ID: <1495029955430-48051.post@n5.nabble.com> Hi, I have been working on a piece of code and suddenly getting these errors: /Users/poojabhalode/.bash_profile: line 1: .bashrc: No such file or directory [[ 2 -1 0] [-1 2 -1] [ 0 -1 2]] [[ 3.41421356e+00 8.32667268e-17 -6.37995760e-17] [ 0.00000000e+00 2.00000000e+00 1.35170527e-16] [ 0.00000000e+00 0.00000000e+00 5.85786438e-01]] 8.32667268469e-17 8.32667268469e-17 -6.37995760397e-17 0.0 1.35170526715e-16 0.0 0.0 [[ 3.41421356 0. 0. ] [ 0. 2. 0. ] [ 0. 0. 0.58578644]] Traceback (most recent call last): File "/Users/poojabhalode/Google Drive/PYTHON/files/1sttest/May17.py", line 7, in import matplotlib File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/__init__.py", line 947, in rcParams = rc_params() File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/__init__.py", line 856, in rc_params fname = matplotlib_fname() File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/__init__.py", line 726, in matplotlib_fname configdir = _get_configdir() File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/__init__.py", line 597, in _get_configdir return _get_config_or_cache_dir(_get_xdg_config_dir()) File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/__init__.py", line 566, in _get_config_or_cache_dir if not _is_writable_dir(p): File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/__init__.py", line 228, in _is_writable_dir t = tempfile.TemporaryFile(dir=p) AttributeError: 'module' object has no attribute 'TemporaryFile' [Finished in 0.2s with exit code 1] [shell_cmd: python -u "/Users/poojabhalode/Google Drive/PYTHON/files/1sttest/May17.py"] [dir: /Users/poojabhalode/Google Drive/PYTHON/files/1sttest] [path: /usr/bin:/bin:/usr/sbin:/sbin] My code gives errors at the import statement itself: Code:: import matplotlib ERROR indicated here. matplotlib.use("TkAgg") from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg from matplotlib.figure import Figure Can someone please let me know what is going wrong with this? Thank you. I would really appreciate it. Thanks! -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Matplotlib-tkinter-error-tp48051.html Sent from the matplotlib - users mailing list archive at Nabble.com. From ineedemail at gmx.de Fri May 19 08:36:13 2017 From: ineedemail at gmx.de (SilverSurfer) Date: Fri, 19 May 2017 12:36:13 -0000 Subject: [Matplotlib-users] Superimpose circles on a contourf plot Message-ID: <1495197371826-48053.post@n5.nabble.com> Dear all I am new to matplotlib and python. Up until now i was able to achieve what i wanted, but now i run into a weird problem. If i superimpose markers onto a countourf plot they change their size when i zoom into and area off the plot. The information i use to plot the positions of the circles is gathered from ASE (Atomic Simulation Environment ). I will first try to outline my code without suppling a MWE as this would be hard to do at the moment: __________________________ ..... from matplotlib import pyplot from matplotlib.patches import Circle from ase.io import read, write from ase import Atom from ase.atoms import Atoms import pylab #xarray,yarray are the x and y coordinates ,DATA contains a density at this point niso=1#min max value ncontours=512# number off contours ###ploting starts here myplot = pylab.contourf(xarray,yarray,DATA,ncontours,antialiased=False,cmap=my_cmap,vmin=-niso,vmax=niso) atoms=read('somedata', format="vasp") for atom in atoms color = my_colors_DCLN[atom.number] radius = radii[atom.number] struc = pylab.plot(atom.x, atom.y, color='black', linestyle='solid', marker='o', markerfacecolor=color, markersize=(1.2+radius*3.8),alpha=0.45) #circle = Circle((atom.x, atom.y), (radius/3.5), facecolor=color,edgecolor='k', linewidth=0.4)#alpha=10) #ax.add_patch(circle)) #ax.axis('equal') #ax.set_xticks([]) #ax.set_yticks([]) #ax.axis('off') density_plot pylab.axis('image') plt.Figure() plt.draw() pylab.show() _______________________ If i use the normal markers from matplotlib everything works correct. My DATA that i plot with contourf has the same dimensions as the atoms object. So i only need to have the xy coordinates of this object. I can plot the atoms object fine if i do it like this: ____________ import numpy as np from matplotlib import pyplot from ase.lattice.surface import fcc111 from ase import Atom from ase.data import covalent_radii as radii from ase.data.colors import jmol_colors from matplotlib.patches import Circle from ase.io import read, write fig, ax = pyplot.subplots() atoms = read('somedata', format="vasp") for atom in atoms: color = my_colors[atom.number] radius = radii[atom.number] circle = Circle((atom.x, atom.y), (radius), facecolor=color,edgecolor='k', linewidth=0.4) ax.add_patch(circle) # Enforce the circles are round (equal x and y scales) and turn off # tickmarks. ax.axis('equal') ax.set_xticks([]) ax.set_yticks([]) ax.axis('off') fig.savefig('out.png',dpi=300) pyplot.draw() pyplot.show() _____________________ But i do not know what "fig, ax = pyplot.subplots()" does and how i could incoporate this code in a way that i can supperimpose it to my contourf plot. The Contourf plot is the important information and i just want to show the positions of certian atoms ( circles) ontop of this plot. Thank you in advance fabian -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Superimpose-circles-on-a-contourf-plot-tp48053.html Sent from the matplotlib - users mailing list archive at Nabble.com. From azarmi at gmail.com Wed May 24 18:54:03 2017 From: azarmi at gmail.com (arash) Date: Wed, 24 May 2017 22:54:03 -0000 Subject: [Matplotlib-users] animation in thread Message-ID: <1495666441748-48055.post@n5.nabble.com> I am new to matplotlib and I am trying to get started with animation library.There is an example here for a simple strip chart:https://matplotlib.org/examples/animation/strip_chart_demo.htmlI tried to use this example in a thread. I created a simple *threading.Thread* class, and in it's* run() *method, called:ani = animation.FuncAnimation(fig, scope.update, emitter, interval=10,True)plt.show()here is class:class graph(threading.Thread): def __init__(self, feeder): threading.Thread.__init__(self) self.fig, self.ax = plt.subplots() self.scope = Scope(self.ax) self.feeder=feeder self.running=True def run(self): while self.running: ani = animation.FuncAnimation(self.fig, self.scope.update, self.feeder.emit_ch1(), interval=1, blit=True) plt.show() but when I start this thread, it never shows the windows. Isn't this right usage? -- View this message in context: http://matplotlib.1069221.n5.nabble.com/animation-in-thread-tp48055.html Sent from the matplotlib - users mailing list archive at Nabble.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From azarmi at gmail.com Wed May 24 19:00:11 2017 From: azarmi at gmail.com (arash) Date: Wed, 24 May 2017 23:00:11 -0000 Subject: [Matplotlib-users] animation in thread In-Reply-To: <1495666441748-48055.post@n5.nabble.com> References: <1495666441748-48055.post@n5.nabble.com> Message-ID: <1495666809985-48056.post@n5.nabble.com> (Resending to correct formatting) I am new to matplotlib and I am trying to get started with animation library. There is an example here for a simple strip chart: https://matplotlib.org/examples/animation/strip_chart_demo.html I tried to use this example in a thread. I created a simple *threading.Thread* class, and in it's *run()* method, called: *ani = animation.FuncAnimation(fig, scope.update, emitter, interval=10,True) plt.show()* here is class: * import matplotlib.pyplot as plt import matplotlib.animation as animation class graph(threading.Thread): def __init__(self, feeder): threading.Thread.__init__(self) self.fig, self.ax = plt.subplots() self.scope = Scope(self.ax) self.feeder=feeder self.running=True def run(self): while self.running: ani = animation.FuncAnimation(self.fig, self.scope.update, self.feeder.emit_ch1(), interval=1, blit=True) plt.show() * but when I start this thread, it never shows the windows. Isn't this right usage? -- View this message in context: http://matplotlib.1069221.n5.nabble.com/animation-in-thread-tp48055p48056.html Sent from the matplotlib - users mailing list archive at Nabble.com. From belafkih.hayat at gmail.com Fri May 26 20:47:32 2017 From: belafkih.hayat at gmail.com (bellafkih) Date: Sat, 27 May 2017 00:47:32 -0000 Subject: [Matplotlib-users] Combine two histogramm in one histogramm Message-ID: <1495844922945-48057.post@n5.nabble.com> Hello, I present a data of each month in histogram, so for each month, there two percentages: first the percentage of messages updates (example: 80 %) and the second, the percentage of non update messages (eg. 20%), i must divide the update messages into two parts: the first : important messages (eg. 70 %) and non important messages (eg 30%). My current solution is to create two histograms, but i ask if there is a possibility to create only graphic, so present the 70 % and 30 % in the part of 80% ? Thanks -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Combine-two-histogramm-in-one-histogramm-tp48057.html Sent from the matplotlib - users mailing list archive at Nabble.com.