Re: [Matplotlib-users] Issue with mplot3d (Not a bug)
It appears I haden't properly updated the package, sorry for the noise. G. Le 18/12/2013 12:16, Guillaume Gay a écrit : Hi all, The following code fails on my box (python3.3, linux Mint 15, latest matplotlib code from github): ```python import matplotlib as mpl from mpl_toolkits.mplot3d import Axes3D import numpy as np import matplotlib.pyplot as plt mpl.rcParams['legend.fontsize'] = 10 fig = plt.figure() ax = fig.gca(projection='3d') theta = np.linspace(-4 * np.pi, 4 * np.pi, 100) z = np.linspace(-2, 2, 100) r = z**2 + 1 x = r * np.sin(theta) y = r * np.cos(theta) ax.plot(x, y, z, label='parametric curve') ax.legend() plt.show() ```python Here is the tail of the traceback: ```python /home/guillaume/python3/lib/python3.3/site-packages/matplotlib-1.4.x-py3.3-linux-x86_64.egg/matplotlib/axes/_base.py incla(self) 895 self.containers= [] 896 -- 897 self.grid(self._gridOn, which=rcParams['axes.grid.which']) 898 props = font_manager.FontProperties(size=rcParams['axes.titlesize'], 899 weight=rcParams['axes.titleweight']) /home/guillaume/python3/lib/python3.3/site-packages/mpl_toolkits/mplot3d/axes3d.py ingrid(self, b, **kwargs) 1254 if len(kwargs) : 1255 b= True - 1256 self._draw_grid= maxes._string_to_bool(b) 1257 1258 def ticklabel_format(self, **kwargs) : AttributeError: 'module' object has no attribute '_string_to_bool' ``` Is there a work around? Shall I rise an issue on github? Cheers, Guillaume -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Issue with mplot3d
Hi all, The following code fails on my box (python3.3, linux Mint 15, latest matplotlib code from github): ```python import matplotlib as mpl from mpl_toolkits.mplot3d import Axes3D import numpy as np import matplotlib.pyplot as plt mpl.rcParams['legend.fontsize'] = 10 fig = plt.figure() ax = fig.gca(projection='3d') theta = np.linspace(-4 * np.pi, 4 * np.pi, 100) z = np.linspace(-2, 2, 100) r = z**2 + 1 x = r * np.sin(theta) y = r * np.cos(theta) ax.plot(x, y, z, label='parametric curve') ax.legend() plt.show() ```python Here is the tail of the traceback: ```python /home/guillaume/python3/lib/python3.3/site-packages/matplotlib-1.4.x-py3.3-linux-x86_64.egg/matplotlib/axes/_base.py incla(self) 895 self.containers= [] 896 -- 897 self.grid(self._gridOn, which=rcParams['axes.grid.which']) 898 props = font_manager.FontProperties(size=rcParams['axes.titlesize'], 899 weight=rcParams['axes.titleweight']) /home/guillaume/python3/lib/python3.3/site-packages/mpl_toolkits/mplot3d/axes3d.py ingrid(self, b, **kwargs) 1254 if len(kwargs) : 1255 b= True - 1256 self._draw_grid= maxes._string_to_bool(b) 1257 1258 def ticklabel_format(self, **kwargs) : AttributeError: 'module' object has no attribute '_string_to_bool' ``` Is there a work around? Shall I rise an issue on github? Cheers, Guillaume -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] who (F/OSS science) uses matplotlib?
Le 05/06/2012 16:25, Tom Dimiduk a écrit : Is any of this stuff I should be looking to upstream or split off into the start of a scientific imaging library for python? Have you had a look at skimage https://github.com/scikits-image ? BTW I uses matplotlib (and the whole pylab suite) in my projects for all the visualisation. A (peer reviewed published) example here: https://github.com/Kinetochore-segregation Best Guillaume -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Slow imshow when zooming or panning with several synced subplots
Hello What is the size of a single image file? If they are very big, it is better to do everything from processing to ploting at once for each file. Le 23/05/2012 10:11, Sergi Pons Freixes a écrit : I'm plotting several images at once, sharing axes, because I use it for exploratory purposes. Each image is the same satellite image at different dates. I'm experimenting a slow response from matplotlib when zooming and panning, and I would like to ask for any tips that could speed up the process. What I am doing now is: - Load data from several netcdf files. - Calculate maximum value of all the data, for normalization. - Create a grid of subplots using ImageGrid. As each subplot is generated, I delete the array to free some memory (each array is stored in a list, the deletion is just a list.pop()). See the code below. It's 15 images, single-channel, of 4600x3840 pixels each. This is a lot of data. 8bit or 16bit ? I've noticed that the bottleneck is not the RAM (I have 8 GB), but the processor. Python spikes to 100% usage on one of the cores when zooming or panning (it's an Intel(R) Core(TM) i5-2500 CPU @ 3.30GHz, 4 cores, 64 bit). The code is: --- import os import sys import numpy as np import netCDF4 as ncdf import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import ImageGrid from matplotlib.colors import LogNorm MIN = 0.001 # Hardcoded minimum data value used in normalization variable = 'conc_chl' units = r'$mg/m^3$' data = [] dates = [] # Get a list of only netCDF files filelist = os.listdir(sys.argv[1]) filelist = [f for f in filelist if os.path.splitext(f)[1] == '.nc'] filelist.sort() filelist.reverse() # Load data and extract dates from filenames for f in filelist: everything should happen in this loop dataset = ncdf.Dataset(os.path.join(sys.argv[1],f), 'r') data.append(dataset.variables[variable][:]) instead of creating this big list, use a temporary array (which will be overwritten) dataset.close() dates.append((f.split('_')[2][:-3],f.split('_')[1])) # Get the maximum value of all data. Will be used for normalization maxc = np.array(data).max() # Plot the grid of images + dates fig = plt.figure() grid = ImageGrid(fig, 111,\ nrows_ncols = (3, 5),\ axes_pad = 0.0,\ share_all=True,\ aspect = False,\ cbar_location = right,\ cbar_mode = single,\ cbar_size = '2.5%',\ ) for g in grid: v = data.pop() d = dates.pop() im = g.imshow(v, interpolation='none', norm=LogNorm(), vmin=MIN, vmax=maxc) g.text(0.01, 0.01, '-'.join(d), transform = g.transAxes) # Date on a corner cticks = np.logspace(np.log10(MIN), np.log10(maxc), 5) cbar = grid.cbar_axes[0].colorbar(im) cbar.ax.set_yticks(cticks) cbar.ax.set_yticklabels([str(np.round(t, 2)) for t in cticks]) cbar.set_label_text(units) # Fine-tune figure; make subplots close to each other and hide x ticks for # all fig.subplots_adjust(left=0.02, bottom=0.02, right=0.95, top=0.98, hspace=0, wspace=0) grid.axes_llc.set_yticklabels([], visible=False) grid.axes_llc.set_xticklabels([], visible=False) plt.show() --- Any clue about what could be improved to make it more responsive? PD: This question has been posted previously on Stackoverflow, but it hasn't got any answer: http://stackoverflow.com/questions/10635901/slow-imshow-when-zooming-or-panning-with-several-synced-subplots -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Slow imshow when zooming or panning with several synced subplots
Le 23/05/2012 15:04, Sergi Pons Freixes a écrit : On Wed, May 23, 2012 at 11:00 AM, Guillaume Gay guilla...@mitotic-machine.org wrote: Hello What is the size of a single image file? If they are very big, it is better to do everything from processing to ploting at once for each file. As stated below, each image is single-channel, of 4600x3840 pixels. As you can see on the code, there is not much processing, just loading the images and plotting them. What it's slow is not the execution of the code, is the interactive zooming and panning once the plots are in the screen. It's 15 images, single-channel, of 4600x3840 pixels each. This is a lot of data. 8bit or 16bit ? They are floating point values (for example, from 0 to 45.xxx). If I understood correctly, setting the vmin and vmax, matplotlib should normalize the values to an appropriate number of bits. for f in filelist: everything should happen in this loop dataset = ncdf.Dataset(os.path.join(sys.argv[1],f), 'r') data.append(dataset.variables[variable][:]) instead of creating this big list, use a temporary array (which will be overwritten) dataset.close() dates.append((f.split('_')[2][:-3],f.split('_')[1])) Why? It's true that this way at the beginning it eats a lot of RAM, but then it is released after each pop() oh I didn't see the pop()... So now then I don't know... Do you have to show them full-scale? Maybe you can just use thumbnails of sort? G. (and calculating the maximum of all the data without plotting is needed to use the same normalization level on all the plots). Anyway, the slowness ocurrs during the interaction of the plot, not during the execution of the code. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] variable data set plotting
Hi Fransesco, This is possible indeed, from the doc: http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot: you can do this: a.plot(x1, y1, 'g^', x2, y2, 'g-') But I would rather set up a loop: for file in sys.arv[1:]: ... #read your data plt.plot(xn,yn) Hope this helps. Guillaume Le 07/04/2012 10:36, Francesco Oteri a écrit : Dear Matplotlib users, I am trying to write a script that read a variable number of data set like: script.py set0.dat set1.dat . setN.dat The problem rise in the method plt.plot() because I don't know how manage a variable number of argument. I am wondering wether exists something like: plt.plot([ (x0,y0,g-),(x1,y1,b-),...,(xN,yN,b-)] Francesco -- For Developers, A Lot Can Happen In A Second. Boundary is the first to Know...and Tell You. Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! http://p.sf.net/sfu/Boundary-d2dvs2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users attachment: guillaume.vcf-- For Developers, A Lot Can Happen In A Second. Boundary is the first to Know...and Tell You. Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! http://p.sf.net/sfu/Boundary-d2dvs2___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Figure save hack
Hi, I have been dreaming about this for a long time too, This would really be a nice feature. I often need to come back to the formatting of a plot, and its formatting only, without the need to really access the data (which I often end up calculating again!) Guillaume Le 16/03/2012 09:17, David Verelst a écrit : Hi, This sounds actually very interesting. I have been thinking about how to save matplotlib figures in a way comparable to the Matlab .fig format: a file that holds the data (for instance using HDF5/pytables, some figures might hold a lot of data) and the plotting commands to exactly reconstruct the figure. However, I never got around of thinking about an actual implementation for Matplotlib. Hopefully your work can inspire me to actually get it started , and I will try to find some time to dig in your code the coming weeks. At the Spyder mailing list the idea of saving figures a la Matlab briefly popped before as well: http://groups.google.com/group/spyderlib/browse_thread/thread/bf582bac96ff875/d5e94fe9296afbe5 I think saving figures in this manner would be a nice feature for matplotlib. Thanks for sharing this! Regards, David PS: sorry to Sebastian for sending the message twice On 15/03/12 11:22, Sebastian Berg wrote: Hey, last weekend I wrote a hook which can track figure creation. Basically it takes care of creating the new figure and wraps it to track all changes to it. Its a hack, and the code is not cleaned up or tested much, but I like to do scripts that I run with many parameters to create plots and it works well to allow me to open the figures in a way that I can zoom, etc. and would allow editing (a bit) later on too. So while I doubt the approach can be made something serious, and there are probably things that don't work (right now 3D Axis can be done with a bit extra but mouse zooming does not work inside a 3D Axis, though I think its likely not difficult to change), I thought I would put it online because I am not aware of any way to save matplotlib figures: https://github.com/seberg/haunter-for-matplotlib-figures Maybe someone finds it useful or interesting :) Regards, Sebastian Berg -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users attachment: guillaume.vcf-- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Move the content of a figure into a subplot of this figure.
Hi list, I am trying to implement some GUI tools in matplotlib - more precisely a line profile tool and a contrast setter which I hope will be integrated to the skimage kit [see https://github.com/glyg/scikits-image/blob/master/skimage/io/_plugins/matplotlib_plugin.py]. Now here is my question: Is it possible to grab the content of a figure and 'displace' it in a subplot of the same figure, to give room for a knew plot - even if the original content is complex (i.e. an image + a colorbar + an histogram, for example). I am not sure I'm clear here, so I can try to rephrase if needed. Thanks Guillaume attachment: guillaume.vcf-- Virtualization Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users