Re: [Matplotlib-users] I cannot change the axis tick separation or nbins in Axis artist
Dear Jody, This is the original code that I am using: http://old.nabble.com/Taylor-diagram-(2nd-take)-p33364690.html It is a code that plots Taylor diagrams. I would like to get ticks every two points in the standard deviation axis of the Taylor diagrams to avoid overlapping of labels (as I am making a figure with several small Taylor Diagrams subplots). Thanks! Patricia -- View this message in context: http://matplotlib.1069221.n5.nabble.com/I-cannot-change-the-axis-tick-separation-or-nbins-in-Axis-artist-tp40446p40454.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] xelatex with pdf multipage
Objective: produce multi-page pdfs using xelatex so I can have advanced latex and stix fonts (using xits package) I've used pdf multipage with the recipe: import matplotlib as mpl mpl.use ('pdf') import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages pdf = PdfPages('test_uw3.pdf') for page in ... fig = plt.figure() pdf.savefig (fig) plt.close() pdf.close() Now I'm interested in using xelatex (to use stix fonts). So I saw the I should use pgf If I add: from matplotlib.backends.backend_pgf import FigureCanvasPgf matplotlib.backend_bases.register_backend('pdf', FigureCanvasPgf) as suggested by http://matplotlib.org/users/pgf.html I get an error: Traceback (most recent call last): File ./read_hist3.py, line 121, in module pdf.savefig (fig) File /usr/lib64/python2.7/site-packages/matplotlib/backends/backend_pdf.py, line 2258, in savefig figure.savefig(self, format='pdf', **kwargs) File /usr/lib64/python2.7/site-packages/matplotlib/figure.py, line 1363, in savefig self.canvas.print_figure(*args, **kwargs) File /usr/lib64/python2.7/site-packages/matplotlib/backend_bases.py, line 2093, in print_figure **kwargs) File /usr/lib64/python2.7/site-packages/matplotlib/backend_bases.py, line 1943, in _print_method return print_method(*args, **kwargs) File /usr/lib64/python2.7/site-packages/matplotlib/backends/backend_pgf.py, line 830, in print_pdf raise ValueError(filename must be a path or a file-like object) ValueError: filename must be a path or a file-like object Any ideas? -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] cross correlation
Hi Sudheer, Le 21/02/2013 02:22, Sudheer Joseph a écrit : Thank you very much Smith and Paul, I was away from office due to a medical situation. So could not respond and thank you regarding the help. I have got the results now and the tips from both of you were extremely useful. I am facing an issue with the code when I call plt.xcorr, in a loop. it builds up usage of memory by python and reaches to the RAM what ever available ( in my 4 GB laptop it reaches almost full and in my 24 GB desktop it reaches the available. I suspected the plot not being closed during each iteration so have given a plt.close('all') in the loop. after which it is taking a good time to run the code which was otherwise faster until ram usage reaches its maximum. Is there a way to get out of this situation?. I am attaching the code here and also the link to the data I am using. If possible kindly help. Thanks for sharing the code. By a quick look at gen_xcorr_wnd.py, you are generating a quite high number (about len(lons)*len(lats)) of xcorr series over 365 lags. Here are two thoughts about why I would not recommend using xcorr from matplotlib for this job : 1) There is an overhead in creating a plot object which is unnecessary since you're only interested in correlation values 2) internally, plt.xcorr uses numpy.correlate (https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/axes.py#L4319 and https://github.com/numpy/numpy/blob/master/numpy/core/numeric.py#L731) which is quite fast but unfortunately cannot be well tuned in terms of the output length (only three modes : 'valid', 'same' or 'full'. Matplotlib uses 'full' ) All this to say that when you're interested in 365 correlation values, the internal computations takes place on (N+M-1) points (where N, M are the length of the input vectors, i.e. 2189 if I'm right) and so about 90 % of the output is thrown away. This being said, there is a tiny issue : I don't know a good module which has the (x)correlation function. statsmodel has acf (aka correlation) but I don't remember if there is crosscorrelation. For acf has two computation modes : one based on fft, one based on numpy.correlate which suffer from the same problem as matplotlib's xcorr ( https://github.com/statsmodels/statsmodels/blob/master/statsmodels/tsa/stattools.py#L347) best, Pierre signature.asc Description: OpenPGP digital signature -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] cross correlation
Le 21/02/2013 17:33, Sudheer Joseph a écrit : Thank you Pierre, I will test the other options. I did not know the number limitation in case of plt.xcorr. Thanks a lot with best regards, Just for reference : http://stackoverflow.com/questions/6991471/computing-cross-correlation-function You'll see that (cross)correlation in Python a long ongoing topic. best, Pierre signature.asc Description: OpenPGP digital signature -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] I cannot change the axis tick separation or nbins in Axis artist
On Thu, Feb 21, 2013 at 1:08 AM, patricia ptramba...@hotmail.com wrote: Dear Jody, This is the original code that I am using: http://old.nabble.com/Taylor-diagram-(2nd-take)-p33364690.html It is a code that plots Taylor diagrams. I would like to get ticks every two points in the standard deviation axis of the Taylor diagrams to avoid overlapping of labels (as I am making a figure with several small Taylor Diagrams subplots). Thanks! Patricia Patrica, Could you post a simple, self contained example that demonstrates your problem (see http://sscce.org/). I'd like to help you, but don't have the bandwidth to dig through all that code. A link to pastebin, a github gist or similar service would be preferred. -paul -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] I cannot change the axis tick separation or nbins in Axis artist
AxisArtist utilizes a different (compared to the vanilla matplotlib) mechanism for determining tick location etc., so some of the matplotlibcommands do not work. Unfortunately, AxisArtist is still not well documented, and things are often opaque. Below I implemented a method that you can use to control the nbins. To manually specify the tick locations you need to use the FixedLocator. IHTH, -JJ class TaylorDiagram(object): ... def set_nbins(self, nbins): ghelper = self._ax.get_grid_helper() # get grid_helper ghelper.grid_finder.grid_locator2.set_params(nbins=nbins) # update the parameter of the grid_locator2 (2 means 2nd coordinate). Helper. invalidate () # invalidate the helper so that new parameters become effective On Thu, Feb 21, 2013 at 6:08 PM, patricia ptramba...@hotmail.com wrote: Dear Jody, This is the original code that I am using: http://old.nabble.com/Taylor-diagram-(2nd-take)-p33364690.html It is a code that plots Taylor diagrams. I would like to get ticks every two points in the standard deviation axis of the Taylor diagrams to avoid overlapping of labels (as I am making a figure with several small Taylor Diagrams subplots). Thanks! Patricia -- View this message in context: http://matplotlib.1069221.n5.nabble.com/I-cannot-change-the-axis-tick-separation-or-nbins-in-Axis-artist-tp40446p40454.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users