Re: [Matplotlib-users] subplot layout
Yes, the left hand axis is shrinking in the vertical because it is applying the aspect ratio appropriate for 15 N and the N/S extent of your data. Either make the N/S extent of the map larger; make the left hand column wider; or make the figure shorter. Cheers, Jody > On 25 Apr 2016, at 9:05 AM, Sudheer Joseph <sudheer.jos...@yahoo.com> wrote: > > Hi, > I am looking for a layout as seen in the empty layout attached > which is produced using > figsize(20,8),subplot(1,2,1);subplot(222);subplot(224) > > However when I use it for getting attached second figure the layout gets > modified as seen in attached figure 2. > fig = p.figure(figsize=(20,8)) > ax=p.subplot(121) > ax1=p.subplot(222) > ax2=p.subplot(224) > > Can any one suggest a way to get figure exactly as the empty layout? > > With best regards, > Sudheer > > *** Sudheer > Joseph Indian National Centre for Ocean Information Services Ministry > of Earth Sciences, Govt. of India POST BOX NO: 21, IDA Jeedeemetla P.O. Via > Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55 > Tel:+91-40-23886047(O),Fax:+91-40-23895011(O), > Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) > E-mail:sjo.in...@gmail.com;sudheer.jos...@yahoo.com Web- > http://oppamthadathil.tripod.com > ***-- > Find and fix application performance issues faster with Applications Manager > Applications Manager provides deep performance insights into multiple tiers of > your business applications. It resolves application problems quickly and > reduces your MTTR. Get your free trial! > https://ad.doubleclick.net/ddm/clk/302982198;130105516;z___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Jody Klymak http://web.uvic.ca/~jklymak/ -- Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] zorder taking an array
For my backend (nbagg), the order of the data determines the order of drawing. So in the following, the third diamond covers the first two in the first plot, but the first diamond covers them all in the second plot. Perhaps not as elegant as a matrix zorder, but can achieve the effect you are after. Cheers, Jody fig, ax = plt.subplots(2,1) x = np.arange(3) y = 0.*x ax[0].plot(x,y,'d',markersize=52) ax[0].set_xlim(-10.,10.) ax[1].plot(x[[2,1,0]],y[[2,1,0]],'d',markersize=52) ax[1].set_xlim(-10.,10.) On Jun 23, 2015, at 9:44 AM, Benjamin Root ben.r...@ou.edu wrote: I see what you are getting at. The issue is that artists are first sorted by the zorder and then drawn one at a time. The draw for a collection artist is an at-once operation, it can't (currently) be split out and interspersed with the draws from another artist. This is one of the major limitations for mplot3d, as it would be nice to compose a 3d scene properly so that everything is logically consistent. I have actually been working on some changes that would allow one to sort the draws of individual elements of a collection, but I still haven't figured out a way to break out the elements with other collection elements in a way that doesn't break the current design or introduce major performance penalties. Maybe I'll figure something out during SciPy2015. Cheers! Ben Root On Tue, Jun 23, 2015 at 5:44 AM, Simon Walker s.r.walker...@googlemail.com mailto:s.r.walker...@googlemail.com wrote: When multiple datasets are plotted on the same axis, the points overlay each other making it hard to see the points under the most recent ones. One way to avoid this is to give each point a random zorder, randomising its position in the z axis. This way, points from the first dataset may overly points from the last dataset. This could be achieved nicely if the zorder keyword took an array so the random zorder values per point can be pre-computed, but currently it only accepts a single number for the whole dataset. Would this be a useful feature for others to have? How difficult would it be to implement? Thanks, Simon Walker -- Monitor 25 network devices or servers for free with OpManager! OpManager is web-based network management software that monitors network devices and physical virtual servers, alerts via email sms for fault. Monitor 25 devices for free with no restriction. Download now http://ad.doubleclick.net/ddm/clk/292181274;119417398;o http://ad.doubleclick.net/ddm/clk/292181274;119417398;o ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Monitor 25 network devices or servers for free with OpManager! OpManager is web-based network management software that monitors network devices and physical virtual servers, alerts via email sms for fault. Monitor 25 devices for free with no restriction. Download now http://ad.doubleclick.net/ddm/clk/292181274;119417398;o___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Monitor 25 network devices or servers for free with OpManager! OpManager is web-based network management software that monitors network devices and physical virtual servers, alerts via email sms for fault. Monitor 25 devices for free with no restriction. Download now http://ad.doubleclick.net/ddm/clk/292181274;119417398;o___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib documentation from python notebook?
Hi Ben, My idea was to just make the notebook the “example”. But nbconvert-ing the notebook makes static images that then need to be checked into the repository, and take space, so I wasn’t sure how desirable that was. It would be fun to have the documentation script accept ipython notebooks and run nbconvert on them. Being able to save state as you work through examples is quite nice, versus creating five or six standalone *.py files that then get run at build time. Of course you are adding a dependency to anyone who has wants to build the docs. Thanks, Jody On 8 Jun 2015, at 13:35 PM, Benjamin Root ben.r...@ou.edu wrote: No, there isn't an accepted way to do that AFAIK. However, it doesn't seem like it is all that far off. Our doc-build process will create the images from the examples automatically, so you don't need to include the image tag. It is sort of a way to make sure the examples work and that the image matches the code correctly. On Mon, Jun 8, 2015 at 1:06 PM, Jody Klymak jkly...@uvic.ca mailto:jkly...@uvic.ca wrote: Hi all, If I want to contribute *.rst files to the matplotlib documentation, I can see a few styles already contributed, at least one of which makes extensive use of ipython (http://matplotlib.org/users/image_tutorial.html http://matplotlib.org/users/image_tutorial.html). However, even it makes use of `.. sourcecode:: python` and `.. plot::` blocks. If I convert an ipython notebook to rst, it formats as: `.. code:: python` and instead of making plots it loads images: `.. image:: MyExample_files/MyExample_1_0.png` So, is there an acceptable way to directly make matplotlib documentation directly from a notebook? I didn’t see anything, but wanted to check, as that would by far be the easiest way to make a *.rst that had structured text, code, and plots. Thanks, Jody -- Jody Klymak http://web.uvic.ca/~jklymak/ http://web.uvic.ca/~jklymak/ -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Jody Klymak http://web.uvic.ca/~jklymak/ -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] matplotlib documentation from python notebook?
Hi all, If I want to contribute *.rst files to the matplotlib documentation, I can see a few styles already contributed, at least one of which makes extensive use of ipython (http://matplotlib.org/users/image_tutorial.html). However, even it makes use of `.. sourcecode:: python` and `.. plot::` blocks. If I convert an ipython notebook to rst, it formats as: `.. code:: python` and instead of making plots it loads images: `.. image:: MyExample_files/MyExample_1_0.png` So, is there an acceptable way to directly make matplotlib documentation directly from a notebook? I didn’t see anything, but wanted to check, as that would by far be the easiest way to make a *.rst that had structured text, code, and plots. Thanks, Jody -- Jody Klymak http://web.uvic.ca/~jklymak/ -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [matplotlib-devel] RFC: candidates for a new default colormap
On 5 Jun 2015, at 9:27 AM, Thomas Caswell tcasw...@gmail.com wrote: Jody, This has come up before and the consensus seemed to be that for the anomaly data sets knowing where the zero is is very important and the default color limits will probably get that wrong. So long as the user has to set the limits, they can also select one of the diverging color maps. OK, fair enough - if the consensus is that people who want diverging colormaps need to know what they are doing, and the default is only for sequential data, then that argument has merit. I do not look forward to seeing the first student talks that try to contour velocity data using one of these colormaps, but maybe the results will be so ghastly the naive user will realize they need to do something more appropriate. However, if sequential is what you have decided, then it is useful to say how the underlying data is distributed: For uniform distributions like those used in the plotted examples, I *prefer* C and D. However, for data like that in the movies, which look to be more Gaussian, I would actually prefer B, or a version of D that went to black and white to better represent the extreme values. Put another way, I’d use A and B, but most of the time I’d set my data limits so that they didn’t saturate as much as they do in the plotted examples. Hopefully that makes sense. Cheers, Jody I also advocate for users/domains which typically plot anomaly/diverging data sets to write helper functions like def im_diverging(ax, data, cmap='RbBu', *args, **kwargs): limits = some_limit_function(data) return ax.imshow(data, cmap=cmap, vmin=limits[0], vmax=limits[1], *args, **kwargs) Tom On Fri, Jun 5, 2015 at 12:18 PM Jody Klymak jkly...@uvic.ca mailto:jkly...@uvic.ca wrote: Hi, This is a great initiative, I love colormaps and am always disatisfied. However, I am concerned about these proposed defaults. As Ben says, there are two types of data sets: “intensity” or “density” data, and data sets with a natural zero (i.e. positive or negative anomaly or velocity). I’d be fine with any of the proposed colormaps for “intensity” data sets, but I would *never* use them for anomaly data sets; I couldn’t tell where the middle (zero) of any of those colormaps are intuitively. Jet and parula, for all their sins, are decent compromises for the naive user (or the user in a rush) because they do a good job of representing both types of data. Even in black and white jet does something reasonable, which is go to dark at extreme values and white-ish in the middle. Jet also has a nice central green hue between blue and yellow that signals zero (or at least it does to me after years of looking at it). I don’t see that jet really loses that under colorblindness; in fact I almost prefer the “Moderate Deuter” version of jet to the actual jet. Anyways, I guess I am advocating trying to find a colormap with a very obvious central hue to represent zero. Anomaly data sets are *very* common, so having a default colormap that doesn’t do something reasonable with them may be a turn off to new users. Cheers, Jody On 5 Jun 2015, at 8:36 AM, Benjamin Root ben.r...@ou.edu mailto:ben.r...@ou.edu wrote: It is funny that you mention that you prefer the warmer colors over the cooler colors. There has been some back-n-forth about which is better. I personally have found myself adverse to using just cool or just warm colors, preferring a mix of cool and warm colors. Perhaps it is my background in meteorology and viewing temperature maps? Another place where a mix of cool and warm colors are useful is for severity indications such as radar maps. It is no accident that radar maps are colored greens and blues for weak precipitation, then yellow for heavier, and then reds for heaviest (possibly severe) precipitation -- it came from the old FAA color guides. While we all know that that colormap is fundamentally flawed, there was a rationale behind it. Hopefully I will have some time today to play around with the D option. I want to see if I can shift the curve a bit to include more yellows and orange so that it can have a mix of cool and warm colors. Ben Root On Fri, Jun 5, 2015 at 11:21 AM, Philipp A. flying-sh...@web.de mailto:flying-sh...@web.de wrote: I vote for A and B. Only B if i get just one vote. C is too washed out and i like the warm colors more than the cold ones in D. It’s funny that this comes up while I’m handling colormaps in my own work at the moment. Neal Becker ndbeck...@gmail.com mailto:ndbeck...@gmail.com schrieb am Fr., 5. Juni 2015 um 12:58 Uhr: I vote for D, although I like matlab's new default even better -- ___ Matplotlib-users mailing list Matplotlib-users
Re: [Matplotlib-users] [matplotlib-devel] RFC: candidates for a new default colormap
Hi, On 5 Jun 2015, at 11:17 AM, Sourish Basu sourish.b...@gmail.com wrote: On 06/05/2015 10:17 AM, Jody Klymak wrote: Anyways, I guess I am advocating trying to find a colormap with a very obvious central hue to represent zero. Anomaly data sets are *very* common, so having a default colormap that doesn’t do something reasonable with them may be a turn off to new users. I agree that jet does a bad job with anomaly data, but I disagree that having a diverging colormap as default (or even a diverging argument to anything that takes a cmap value) would solve that. Very often the zero of an anomaly is not at the center of the extrema, and requires creating a custom diverging colormap anyway (see attached example). Well, I *strongly* disagree with that attached example! It makes it look like -0.5 is equivalent to +1.5! Unless there is a really strong reason to do that, I think that is poor practice as it makes your negative anomalies look far stronger than your positive, and that is not the case in the underlying numbers. Cheers, Jody OT, I recently found a nice alternative to jet here:https://mycarta.wordpress.com/2014/11/13/new-rainbow-colormap-sawthoot-shaped-lightness-profile/ https://mycarta.wordpress.com/2014/11/13/new-rainbow-colormap-sawthoot-shaped-lightness-profile/ It takes care of my biggest crib with jet, which is that there is not enough perceptual variation in the middle of the range. Cheers, Sourish Basu ff_adjustment_winter.png-- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Jody Klymak http://web.uvic.ca/~jklymak/ -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [matplotlib-devel] RFC: candidates for a new default colormap
On 5 Jun 2015, at 11:39 AM, Sourish Basu sourish.b...@gmail.com wrote: This problem is reasonably common for me, BTW. I can have a carbon monoxide field with an average/background of 60 ppb, but variations from 30 to 550 ppb. So I need a color scale which (a) is white at 60, and (b) shows small variations below 60 and large variations above 60 with equal clarity”. If you need to see small changes at low values and they are equally important to large changes at high values, then taking the logarithm is often useful (or scaling your colorbar logarithmically). Cheers, Jody -- Jody Klymak http://web.uvic.ca/~jklymak/ -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [matplotlib-devel] RFC: candidates for a new default colormap
Hi, This is a great initiative, I love colormaps and am always disatisfied. However, I am concerned about these proposed defaults. As Ben says, there are two types of data sets: “intensity” or “density” data, and data sets with a natural zero (i.e. positive or negative anomaly or velocity). I’d be fine with any of the proposed colormaps for “intensity” data sets, but I would *never* use them for anomaly data sets; I couldn’t tell where the middle (zero) of any of those colormaps are intuitively. Jet and parula, for all their sins, are decent compromises for the naive user (or the user in a rush) because they do a good job of representing both types of data. Even in black and white jet does something reasonable, which is go to dark at extreme values and white-ish in the middle. Jet also has a nice central green hue between blue and yellow that signals zero (or at least it does to me after years of looking at it). I don’t see that jet really loses that under colorblindness; in fact I almost prefer the “Moderate Deuter” version of jet to the actual jet. Anyways, I guess I am advocating trying to find a colormap with a very obvious central hue to represent zero. Anomaly data sets are *very* common, so having a default colormap that doesn’t do something reasonable with them may be a turn off to new users. Cheers, Jody On 5 Jun 2015, at 8:36 AM, Benjamin Root ben.r...@ou.edu wrote: It is funny that you mention that you prefer the warmer colors over the cooler colors. There has been some back-n-forth about which is better. I personally have found myself adverse to using just cool or just warm colors, preferring a mix of cool and warm colors. Perhaps it is my background in meteorology and viewing temperature maps? Another place where a mix of cool and warm colors are useful is for severity indications such as radar maps. It is no accident that radar maps are colored greens and blues for weak precipitation, then yellow for heavier, and then reds for heaviest (possibly severe) precipitation -- it came from the old FAA color guides. While we all know that that colormap is fundamentally flawed, there was a rationale behind it. Hopefully I will have some time today to play around with the D option. I want to see if I can shift the curve a bit to include more yellows and orange so that it can have a mix of cool and warm colors. Ben Root On Fri, Jun 5, 2015 at 11:21 AM, Philipp A. flying-sh...@web.de mailto:flying-sh...@web.de wrote: I vote for A and B. Only B if i get just one vote. C is too washed out and i like the warm colors more than the cold ones in D. It’s funny that this comes up while I’m handling colormaps in my own work at the moment. Neal Becker ndbeck...@gmail.com mailto:ndbeck...@gmail.com schrieb am Fr., 5. Juni 2015 um 12:58 Uhr: I vote for D, although I like matlab's new default even better -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Jody Klymak http://web.uvic.ca/~jklymak/ -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [matplotlib-devel] RFC: candidates for a new default colormap
Hi Eric, On 5 Jun 2015, at 12:20 PM, Eric Firing efir...@hawaii.edu wrote: Reminder: in matplotlib, color mapping is done with the combination of a colormap and a norm. This allows one to design a norm to handle the mapping, including any nonlinearity or difference between the handling of positive and negative values. This is more general than customizing a colormap; once you have a norm to suit your purpose, you can use it with any colormap. Though I was hazily aware of norms, I’d not really seen that before. I particularly like the example at http://matplotlib.org/examples/pylab_examples/pcolor_log.html This seems useful enough that a section under “User Guide:Advanced Guide” would be really helpful. An example that displays all the canned norms, and maybe how to make a custom norm. I only found the pcolor_log example by searching for colors.lognorm, which I only knew about from your comment above. There a few hits on stackexchange, but those are for specific instances and hard to find by random. I could help do this, but it’d take a while to actually learn how to use the norms. Thanks, Jody Maybe this is actually what you are already doing, but I wanted to point it out here in case some readers are not familiar with this colormap+norm strategy. Eric -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Jody Klymak http://web.uvic.ca/~jklymak/ -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Confused about rgb_to_hsv and hsv_to_rgb
On May 23, 2015, at 12:07 PM, Eric Firing efir...@hawaii.edu wrote: You might get something more to your liking if you were to start with a colormap in which V is uniform--all variation is in H and S--and then impose the shading on the V. Cubehelix starts with a full range of V, so replacing V with your shading channel completely changes the set of colors you end up with. Or maybe instead of replacing hsv[:,:,2] with dip you scale it by hsv[:,:,2]: hsv[:,:,2]=dip*hsv[:,:,2] Cheers, Jody -- One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] sharex with one figure aspect = 1.0
Hi Eric, import matplotlib.pyplot as plt fig, axes = plt.subplots(nrows=2,sharex=True) axes[0].set_aspect(1.) axes[0].plot(np.arange(10),np.arange(10)) axes[0].set_ylim([0,24]) axes[0].set_xlim([0,12]) axes[1].plot(np.arange(10),np.arange(10)*2.) plt.show() does not work as I'd expect. axes[0]'s ylim gets changed so that the line is no longer viewable (= 10-14). In my opinion, the two calls should work the same, except in the second case, axes[1]'s xlim should be 0-12. If you leave out the set_ylim call, it works. Given that you have specified set_ylim[0, 24], how is mpl supposed to know what ylim range you really want, when the axis constraint means it can only plot a small part of the specified range? It doesn't for me: import matplotlib.pyplot as plt fig, axes = plt.subplots(nrows=2,sharex=True) axes[0].set_aspect(1.) axes[0].plot(np.arange(10),np.arange(10)) axes[1].plot(np.arange(10),np.arange(10)*2.) plt.show() still curtails the y limit in axes[0], in my case from ~2.9 to ~6.1 (see attached). Basically, you have set up conflicting constraints, and mpl failed to resolve the conflict the way you think it should have. Maybe that could be improved, but I warn you, it's a tricky business. Squeeze in one place and things pop out somewhere else. I'm not clear what the conflicting constraints are. There seems to be an unspoken one that sharex=True means the physical size of the axes must be the same. That constraint doesn't exist if sharex=False, and set_aspect() works as expected. I'm questioning the unspoken constraint, and questioning why set_aspect() (or looking at the code apply_aspect()) needs to know about shared axes at all. No doubt there is a use case I'm missing... I *can* see the issue if we think setting aspect ratios should *not* change the size of the axes, because changing the aspect ratio changes the data limits and then you have a problem checking all the shared axes to see which one has the largest data limits. Its particularly problematic because I think that apply_aspect() is only called at draw()-time. That seems a hard problem, but I'm not sure what the use case is for it, so I have trouble wrapping my head around it. Thanks, Jody -- Jody Klymak http://web.uvic.ca/~jklymak/ -- BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15utm_medium=emailutm_campaign=VA_SF___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] sharex with one figure aspect = 1.0
=VA_SF___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15utm_medium=emailutm_campaign=VA_SF___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Jody Klymak http://web.uvic.ca/~jklymak/ -- BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15utm_medium=emailutm_campaign=VA_SF___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Problem with errorbar and log axis
xerr is +/- relative to the data: *xerr*/*yerr*: [ scalar | N, Nx1, or 2xN array-like ] If a scalar number, len(N) array-like object, or an Nx1 array-like object, errorbars are drawn at +/-value relative to the data. If a sequence of shape 2xN, errorbars are drawn at -row1 and +row2 relative to the data. I think you want: xdat=10**data_x_log ax.errorbar(10**data_x_log,data_y,xerr=[xdat-error_x_lower,error_x_upper-xdat],ls='',marker='o') Cheers, Jody On 7 Apr 2015, at 13:51 PM, Markus Haider markus.hai...@uibk.ac.at wrote: I have the error from a table which is in log units, and the error is given to be symmetric in log space. Cheers, Markus On 2015-04-07 16:40, Yuxiang Wang wrote: Typo - standard deviation OR standard error of mean, not OF. Sorry. Shawn On Tue, Apr 7, 2015 at 10:39 AM, Yuxiang Wang yw...@virginia.edu wrote: If you error bars denote standard deviation of standard error of mean, shouldn't they be non-symmetric in log scale? Shawn On Tue, Apr 7, 2015 at 10:11 AM, Markus Haider markus.hai...@uibk.ac.at wrote: Hi, I am trying to make an errorbar plot with a logarithmic x-axis. I have symmetric errors in logspace, however if I plot them, the errors are not symmetric anymore, as you can see in the enclosed image. Am I misunderstanding something or is this a bug? Thanks for your help, Markus Here the code I used to produce the plot: import matplotlib.pyplot as plt import numpy as np data_x_log = np.array([13.0,15.0]) data_y = np.array([0.5,1]) error_x_log = np.array([0.5,1.]) error_x_lower = 10**(data_x_log-error_x_log) error_x_upper = 10**(data_x_log+error_x_log) fig = plt.figure() ax = fig.add_subplot(111) ax.errorbar(10**data_x_log,data_y,xerr=[error_x_lower,error_x_upper],ls='',marker='o') ax.set_xscale('log') ax.set_xlim([1E11,1E17]) ax.set_ylim([0,2]) plt.savefig('error.png') -- BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15utm_medium=emailutm_campaign=VA_SF ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Yuxiang Shawn Wang Gerling Research Lab University of Virginia yw...@virginia.edu +1 (434) 284-0836 https://sites.google.com/a/virginia.edu/yw5aj/ -- BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15utm_medium=emailutm_campaign=VA_SF ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Jody Klymak http://web.uvic.ca/~jklymak/ -- BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15utm_medium=emailutm_campaign=VA_SF ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Color Bar Limits
Hi John, I got this off stack exchange, apologies to the original contributor... Cheers, Jody import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import LinearSegmentedColormap x = np.arange(100) y = np.random.rand(100) z = 4 * np.random.rand(100) cmap = plt.get_cmap('rainbow_r’) start=0.2 stop = 1. colors = cmap(np.linspace(start, stop, cmap.N)) # Create a new colormap from those colors color_map = LinearSegmentedColormap.from_list('Upper Half', colors) fig = plt.figure(figsize=(12,9)) ax1 = plt.subplot(111) sc = ax1.scatter(x, y, c=z, s=50, cmap=color_map, vmin=0, vmax=4) position=fig.add_axes([0.37, 0.16, 0.5, 0.02]) cb = fig.colorbar(sc, cax=position, orientation='horizontal', drawedges=False) cb.set_label('Z-Colors', fontsize=14) # I tried this after talking with Ben Root, but it # results in some odd behavior # cb.ax.set_xlim(0,4) plt.show() On 2 Apr 2015, at 5:47 AM, John Leeman kd5...@gmail.com wrote: Hi all, I’m plotting some scatter points colored by a third variable, but want to use a limited subset of a colormap. In the example below, the color axis data ranges from 0-4, but I want to not use the red portion of the bar. Doing the first part is just accomplished by setting the vmin/vmax. But when I plot a color bar I don’t want to show the colors and values for anything below zero. Other than just white-boxing that part of the bar I’m not sure how to do it. I tried a suggestion of setting the limit properties of the bar axis attribute, but that results in the bar getting shrunk and shifted (a very weird behavior). Any ideas? Thank you, John Leeman import numpy as np import matplotlib.pyplot as plt x = np.arange(100) y = np.random.rand(100) z = 4 * np.random.rand(100) color_map = plt.get_cmap('rainbow_r') fig = plt.figure(figsize=(12,9)) ax1 = plt.subplot(111) sc = ax1.scatter(x, y, c=z, s=50, cmap=color_map, vmin=-1, vmax=4) position=fig.add_axes([0.37, 0.16, 0.5, 0.02]) cb = fig.colorbar(sc, cax=position, orientation='horizontal', drawedges=False) cb.set_label('Z-Colors’, fontsize=14) # I tried this after talking with Ben Root, but it # results in some odd behavior # cb.ax.set_xlim(0,4) plt.show() Color_Bar.png -- Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Jody Klymak http://web.uvic.ca/~jklymak/ -- Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Color Bar Limits
On 2 Apr 2015, at 9:50 AM, Benjamin Root ben.r...@ou.edu wrote: No, that's not what he is asking for. John wants the norm to go from -1 to 4, but he wants the colorbar to display only the 0 to 4 portion. Your approach (setting vmin=0) would change the normalization and change the colors. Hmm, well his values go from 0 to 4, and he wants his colorbar to go from 0 to 4, but just over the last 4/5ths of the colormap. I think I gave him what he wants. But I guess he can decide! Cheers, Jody The axes limits do not appear to be scaled by the values. They are set to (0, 1). So, the kludgy way would seem to be to set the xlimits to be (0.2, 1) (taking out a fifth of the colorbar, but the frame is still there... Ben Root On Thu, Apr 2, 2015 at 12:32 PM, Jody Klymak jkly...@uvic.ca mailto:jkly...@uvic.ca wrote: Hi John, I got this off stack exchange, apologies to the original contributor... Cheers, Jody import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import LinearSegmentedColormap x = np.arange(100) y = np.random.rand(100) z = 4 * np.random.rand(100) cmap = plt.get_cmap('rainbow_r’) start=0.2 stop = 1. colors = cmap(np.linspace(start, stop, cmap.N)) # Create a new colormap from those colors color_map = LinearSegmentedColormap.from_list('Upper Half', colors) fig = plt.figure(figsize=(12,9)) ax1 = plt.subplot(111) sc = ax1.scatter(x, y, c=z, s=50, cmap=color_map, vmin=0, vmax=4) position=fig.add_axes([0.37, 0.16, 0.5, 0.02]) cb = fig.colorbar(sc, cax=position, orientation='horizontal', drawedges=False) cb.set_label('Z-Colors', fontsize=14) # I tried this after talking with Ben Root, but it # results in some odd behavior # cb.ax.set_xlim(0,4) plt.show() On 2 Apr 2015, at 5:47 AM, John Leeman kd5...@gmail.com mailto:kd5...@gmail.com wrote: Hi all, I’m plotting some scatter points colored by a third variable, but want to use a limited subset of a colormap. In the example below, the color axis data ranges from 0-4, but I want to not use the red portion of the bar. Doing the first part is just accomplished by setting the vmin/vmax. But when I plot a color bar I don’t want to show the colors and values for anything below zero. Other than just white-boxing that part of the bar I’m not sure how to do it. I tried a suggestion of setting the limit properties of the bar axis attribute, but that results in the bar getting shrunk and shifted (a very weird behavior). Any ideas? Thank you, John Leeman import numpy as np import matplotlib.pyplot as plt x = np.arange(100) y = np.random.rand(100) z = 4 * np.random.rand(100) color_map = plt.get_cmap('rainbow_r') fig = plt.figure(figsize=(12,9)) ax1 = plt.subplot(111) sc = ax1.scatter(x, y, c=z, s=50, cmap=color_map, vmin=-1, vmax=4) position=fig.add_axes([0.37, 0.16, 0.5, 0.02]) cb = fig.colorbar(sc, cax=position, orientation='horizontal', drawedges=False) cb.set_label('Z-Colors’, fontsize=14) # I tried this after talking with Ben Root, but it # results in some odd behavior # cb.ax.set_xlim(0,4) plt.show() Color_Bar.png -- Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/___ http://goparallel.sourceforge.net/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Jody Klymak http://web.uvic.ca/~jklymak/ http://web.uvic.ca/~jklymak/ -- Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ http://goparallel.sourceforge.net/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Jody Klymak http://web.uvic.ca/~jklymak
Re: [Matplotlib-users] Multiplot with one colorbar
Hi all, Just to follow up, I wrote the following helper function to put a single colorbar to the right of a) an axes, b) a list of axes, c) to the right of a gridspec. I was getting a little peeved with colorbar not working as I liked with subplots or gridspec, and this kind of does the trick for me for most of my use cases. I’m probably not the world’s best python programmer so feel free to make clearer. Cheers, Jody def colorbarRight(pcm,ax,fig,shrink=0.7,width=0.025,gap=0.03,**kwargs): ''' def colorbarRight(pcm,ax,fig,shrink=0.7,width=0.05,gap=0.02) Position colorbar to the right of axis 'ax' with colors from artist pcm. ax can be an array of axes such as that returned by subplots. ax can also be a GridSpec, in which case the colorbar is centered to the right of the grid. Defaults might no leave enough room for the colorbar on the right side, so you should probably use subplots_adjust() or gridspec_update() to make more space to the right: # with subplots: import matplotlib.pyplot as plt fig,ax=plt.subplots(2,2) fig.subplots_adjust(right=0.87) for axx in ax.flatten(): pcm=axx.pcolormesh(rand(10,10)) colorbarRight(pcm,ax,fig,extend='max') # with gridspec: import matplotlib.gridspec import matplotlib.pyplot as plt fig=plt.figure() gs = gridspec.GridSpec(2,2) gs.update(right=0.87) for ii in range(2): for jj in range(2): ax=plt.subplot(gs[ii,jj]) pcm=ax.pcolormesh(rand(10,10)) colorbarRight(pcm,gs,fig,extend='max') ''' import numpy as np if type(ax) is matplotlib.gridspec.GridSpec: # gridspecs are different than axes: pos = ax.get_grid_positions(fig) y0 = pos[0][-1] y1 = pos[1][0] x1 = pos[3][-1] else: if ~(type(ax) is np.ndarray): # these are supposedly axes: ax=np.array(ax) # get max x1, min y0 and max y1 y1 = 0. y0 = 1. x1=0. for axx in ax.flatten(): pos=axx.get_position() x1=np.max([pos.x1,x1]) y1=np.max([pos.y1,y1]) y0=np.min([pos.y0,y0]) height = y1-y0 pos2 = [x1 + gap, y0 + (1.-shrink)*height/2., width, height*shrink] cax=axes(position=pos2) fig.colorbar(pcm,cax=cax,**kwargs) On 11 Mar 2015, at 19:43 PM, Dyah rahayu martiningrum dyahr...@gmail.com wrote: Thank you so much Jody, Eric, Arnaldo, and Joy. I will try your suggestion. Dyah On Sat, Mar 7, 2015 at 5:21 AM, Jody Klymak jkly...@uvic.ca mailto:jkly...@uvic.ca wrote: Hi, I guess I don't understand the [axx for axx in ax.flat] command, but this steals from all the axes. Cheers, Jody fig,ax = plt.subplots(2,2) for i in range(2): for j in range(2): im=ax[i,j].imshow(np.ones((20,20))) im.set_clim([-1.,2.]) cax,kw = mpl.colorbar.make_axes([axx for axx in ax.flat],shrink=0.5) plt.colorbar(im, cax=cax, **kw) On Mar 6, 2015, at 9:39 AM, Eric Firing efir...@hawaii.edu mailto:efir...@hawaii.edu wrote: On 2015/03/05 11:36 PM, Dyah rahayu martiningrum wrote: Hello all, I make multi plot with colorbars. I need help, how do make only one colorbar for six panels? I also want to show only lowest x-axis. I copy my recent code and figure here. An old example of something like this is here: http://matplotlib.org/examples/pylab_examples/multi_image.html http://matplotlib.org/examples/pylab_examples/multi_image.html Eric -- Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ http://goparallel.sourceforge.net/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ http://goparallel.sourceforge.net/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net
Re: [Matplotlib-users] matplotlib basemap streamlines plot
Hi, If your flow is actually non-divergent, so that continuous streamlines make sense, you could contour the streamfunction: a decent approximation should be psi = 0.5*( cumsum(u*dy[:,newaxis],axis=1)-cumsum(v*dx[newaxis,:],axis=0)) Of course this won’t work so well if u and v are coarsely spaced or divergent... Cheers, Jody On Mar 30, 2015, at 20:26 PM, Tony Yu tsy...@gmail.com wrote: On Mon, Mar 30, 2015 at 2:15 PM, Foehn fo...@posteo.org mailto:fo...@posteo.org wrote: Am 2015-03-27 um 15:01 schrieb Sappy85: Hi all, tried to plot a streamline with matplotlib. So far it work's. But my question: Is there a possibility to avoid the gaps in the streamlines (see my picture)? I think the problem is that the streamline algorithm doesn't make any attempt to optimize for longer streamlines. It's been a long time since I've looked at the code, but roughly speaking, the algorithm optimizes for spacing between streamlines. Reducing the `minlength` input *should* slightly prefer longer streamlines, but you'll see side-effects with lines near borders and diverging flows. If changing the `streamplot` implementation is an option, one of the simpler ways to achieve streamlines with fewer gaps would be allow the grid of starting points to vary independently from the grid that determines that streamlines are too close. There are also smarter ways of seeding the streamlines, but that would be a bit more work, I believe. -Tony http://matplotlib.1069221.n5.nabble.com/file/n45276/ff850_0.png http://matplotlib.1069221.n5.nabble.com/file/n45276/ff850_0.png Are you sure your flow is non divergent? Otherwise sinks and sources of streamlines are quite natural. If your flow is divergence free I I frankly admit that I have no idea how to solve the problem with the (then) spurious gaps. Regards, Foehn Regards Sappy85 -- View this message in context: http://matplotlib.1069221.n5.nabble.com/matplotlib-basemap-streamlines-plot-tp45276.html http://matplotlib.1069221.n5.nabble.com/matplotlib-basemap-streamlines-plot-tp45276.html -- Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ANN: John Hunter SciPy 2015 Plotting Contest - Call for Entries by 4/13 (Cash prizes!)
On 26 Mar 2015, at 12:55 PM, Courtenay Godshall (Enthought) cgodsh...@enthought.com wrote: See the 2014 Contest entries here for inspiration: http://stsdas.stsci.edu/download/mdroe/plotting/ http://stsdas.stsci.edu/download/mdroe/plotting/ The plots in here are great! However, I couldn’t figure out who won? Cheers, Jody -- Jody Klymak http://web.uvic.ca/~jklymak/ -- Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Multiplot with one colorbar
Hi, I guess I don't understand the [axx for axx in ax.flat] command, but this steals from all the axes. Cheers, Jody fig,ax = plt.subplots(2,2) for i in range(2): for j in range(2): im=ax[i,j].imshow(np.ones((20,20))) im.set_clim([-1.,2.]) cax,kw = mpl.colorbar.make_axes([axx for axx in ax.flat],shrink=0.5) plt.colorbar(im, cax=cax, **kw) On Mar 6, 2015, at 9:39 AM, Eric Firing efir...@hawaii.edu wrote: On 2015/03/05 11:36 PM, Dyah rahayu martiningrum wrote: Hello all, I make multi plot with colorbars. I need help, how do make only one colorbar for six panels? I also want to show only lowest x-axis. I copy my recent code and figure here. An old example of something like this is here: http://matplotlib.org/examples/pylab_examples/multi_image.html Eric -- Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] subplot axis ticks
http://stackoverflow.com/questions/6682784/how-to-reduce-number-of-ticks-with-matplotlib http://stackoverflow.com/questions/6682784/how-to-reduce-number-of-ticks-with-matplotlib is the easy way. You can also write your own “Locators” that are more sophisticated if you have some ideas in mind (i.e. close to 5 ticks, but you’d prefer whole numbers, etc). http://matplotlib.org/1.4.2/examples/pylab_examples/major_minor_demo1.html http://matplotlib.org/1.4.2/examples/pylab_examples/major_minor_demo1.html Cheers, Jody On Dec 11, 2014, at 6:29 AM, Gabriele Brambilla gb.gabrielebrambi...@gmail.com wrote: Hi all, I'm trying to set the NUMBER of ticks on a subplot axis. Googling I'm finding only how to set the ticks values...but what if I don't know them and for visual reasons I would like to have a fixed number of ticks? thanks Gabriele -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] subplot axis ticks
Yes, this works fine: import numpy as np import matplotlib.pyplot as plt eels= np.random.rand(12) averspe = np.random.rand(12) fig,azal = plt.subplots(1,1) azal.locator_params(nbins=10) azal.plot(eels, averspe, label='data') Cheers, Jody PS, easiest is to include self-contained examples. i.e. we don’t have “averspe” and “eels” so its hard for us to see what you are seeing. On Dec 11, 2014, at 8:29 AM, Benjamin Root ben.r...@ou.edu wrote: You need to do the azal.locator_params() call *after* you create azal. You would get errors otherwise. Ben Root On Thu, Dec 11, 2014 at 11:18 AM, Gabriele Brambilla gb.gabrielebrambi...@gmail.com mailto:gb.gabrielebrambi...@gmail.com wrote: Doing azal.locator_params(nbins=4) azal = rif.add_subplot(111) azal.plot(eels*(10**9), averspe, label='data') azal.plot(eels*(10**9), beck, label='fit') the program runs but locator_params doesn't do anything doing: azal.yaxis.locator_params(nbins=4) azal = rif.add_subplot(111) azal.plot(eels*(10**9), averspe, label='data') azal.plot(eels*(10**9), beck, label='fit') it continue to say that yaxis has not this attribute. Gabriele On Thu, Dec 11, 2014 at 11:07 AM, Benjamin Root ben.r...@ou.edu mailto:ben.r...@ou.edu wrote: I wonder if setting the locator params prior to plotting would fix that? Might be one of those rare situations where the order of commands matter in matplotlib. Ben Root On Thu, Dec 11, 2014 at 10:50 AM, Gabriele Brambilla gb.gabrielebrambi...@gmail.com mailto:gb.gabrielebrambi...@gmail.com wrote: Hi, I already saw that stack overflow page but this is my code: azal = rif.add_subplot(111) azal.plot(eels*(10**9), averspe, label='data') azal.plot(eels*(10**9), beck, label='fit') I tried to add both azal.yaxis.locator_params(nbins=4) or azal.locator_params(nbins=4) and it doesn't work. Gabriele On Thu, Dec 11, 2014 at 10:43 AM, Jody Klymak jkly...@uvic.ca mailto:jkly...@uvic.ca wrote: http://stackoverflow.com/questions/6682784/how-to-reduce-number-of-ticks-with-matplotlib http://stackoverflow.com/questions/6682784/how-to-reduce-number-of-ticks-with-matplotlib is the easy way. You can also write your own “Locators” that are more sophisticated if you have some ideas in mind (i.e. close to 5 ticks, but you’d prefer whole numbers, etc). http://matplotlib.org/1.4.2/examples/pylab_examples/major_minor_demo1.html http://matplotlib.org/1.4.2/examples/pylab_examples/major_minor_demo1.html Cheers, Jody On Dec 11, 2014, at 6:29 AM, Gabriele Brambilla gb.gabrielebrambi...@gmail.com mailto:gb.gabrielebrambi...@gmail.com wrote: Hi all, I'm trying to set the NUMBER of ticks on a subplot axis. Googling I'm finding only how to set the ticks values...but what if I don't know them and for visual reasons I would like to have a fixed number of ticks? thanks Gabriele -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk___ http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Jody Klymak http://web.uvic.ca/~jklymak/ -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously
Re: [Matplotlib-users] Pyplot contour plot - clabel padding
Not sure, as I don't use basemap too often, but I bet calling: m.drawmapboundary(fill_color='w') before clabel would do the trick Cheers, Jody On Dec 9, 2014, at 16:35 PM, Sappy85 robert.wittk...@gmx.de wrote: Hi @all, the problem seems to be solved. Thanks Jody! What i have done: 1.) check out the xlim and ylim after clabel call *xmin, xmax = plt.xlim() # return the current xlim ymin, ymax = plt.ylim() # return the current ylim print xmin,xmax print ymin,ymax* 2.) use and set these limits before clabel call: *plt.xlim(0.0,6475051.47849) plt.ylim(0.0,4412688.31468)* Yes, that's it. Very confusing! I do not understand why that only goes so awkward? Thanks so much! Sappy85 -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Pyplot-contour-plot-clabel-padding-tp44554p44582.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Pyplot contour plot - clabel padding
I meant plt.xlim and plt.ylim. But its hard to tell what the problem is w/o some sample code. Cheers, Jody On Dec 5, 2014, at 1:07 AM, Sappy85 robert.wittk...@gmx.de wrote: Hi Jody, what exactly du you mean - the plot windows size? I tried this: fig = plt.figure(figsize=(8.4,5.76)) But still the same problem. Regards -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Pyplot-contour-plot-clabel-padding-tp44554p44557.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Pyplot contour plot - clabel padding
Hi Your code wans't included, but try setting your x and y limits *before* the call to clabel. I think that the problem is that clabel makes a space in the contours according to how large your font is, but if you then resize the plot (zoom in) then the blank space is too large for the labels. Cheers, Jody On Dec 4, 2014, at 17:47 PM, Sappy85 robert.wittk...@gmx.de wrote: I have trouble with matplotlib / pyplot / basemap. I plot contour lines (air pressure) on a map. I use clabel to show the value of the contour lines. But the problem: the padding between the value and the contour line is too much. I have found the parameter inline_spacing, which i have set to zero. But there is still to much free space. Any ideas? http://matplotlib.1069221.n5.nabble.com/file/n44554/mslp.png My code is as follows: Thanks a lot. -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Pyplot-contour-plot-clabel-padding-tp44554.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Single color transparent colormap
Did you try pcolormesh? Cheers, Jody On Nov 19, 2014, at 7:23 AM, Gael Varoquaux gael.varoqu...@normalesup.org wrote: On Wed, Nov 19, 2014 at 10:20:23AM -0500, Benjamin Root wrote: Notice that the colormap looks fine for the colorbar because it isn't using imshow() under the hood. As a short-term workaround (I work with Loic, and I it would help me a lot if his problem was solved with a hack), can we leverage the mechanism used to plot the colorbar ourselves? That doesn't preclude fixing the problem in master, of course. Cheers, Gaël -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting large file (NetCDF)
It looks like you are calling `pcolor`. Can I suggest you try `pcolormesh`? 75 Mb is not a big file! Cheers, Jody On Sep 8, 2014, at 7:38 AM, Benjamin Root ben.r...@ou.edu wrote: (Keeping this on the mailing list so that others can benefit) What might be happening is that you are keeping around too many numpy arrays in memory than you actually need. Take advantage of memmapping, which most netcdf tools provide by default. This keeps the data on disk rather than in RAM. Second, for very large images, I would suggest either pcolormesh() or just simply imshow() instead of pcolor() as they are more way more efficient than pcolor(). In addition, it sounds like you are dealing with re-sampled data (at different zoom levels). Does this mean that you are re-running contour on re-sampled data? I am not sure what the benefit of doing that is if one could just simply do the contour once at the highest resolution. Without seeing any code, though, I can only provide generic suggestions. Cheers! Ben Root On Mon, Sep 8, 2014 at 10:12 AM, Raffaele Quarta raffaele.qua...@linksmt.it wrote: Hi Ben, sorry for the few details that I gave to you. I'm trying to make a contour plot of a variable at different zoom levels by using high resolution data. The aim is to obtain .PNG output images. Actually, I'm working with big data (NetCDF file, dimension is about 75Mb). The current Matplotlib version on my UBUNTU 14.04 machine is the 1.3.1 one. My system has a RAM capacity of 8Gb. Actually, I'm dealing with memory system problems when I try to make a plot. I got the error message as follow: cs = m.pcolor(xi,yi,np.squeeze(t)) File /usr/lib/pymodules/python2.7/mpl_toolkits/basemap/__init__.py, line 521, in with_transform return plotfunc(self,x,y,data,*args,**kwargs) File /usr/lib/pymodules/python2.7/mpl_toolkits/basemap/__init__.py, line 3375, in pcolor x = ma.masked_values(np.where(x 1.e20,1.e20,x), 1.e20) File /usr/lib/python2.7/dist-packages/numpy/ma/core.py, line 2195, in masked_values condition = umath.less_equal(mabs(xnew - value), atol + rtol * mabs(value)) MemoryError Otherwise, when I try to make a plot of smaller file (such as 5Mb), it works very well. I believe that it's not something of wrong in the script. It might be a memory system problem. I hope that my message is more clear now. Thanks for the help. Regards, Raffaele - Sent: Mon 9/8/2014 3:19 PM To: Raffaele Quarta Cc: Matplotlib Users Subject: Re: [Matplotlib-users] Plotting large file (NetCDF) You will need to be more specific... much more specific. What kind of plot are you making? How big is your data? What version of matplotlib are you using? How much RAM do you have available compared to the amount of data (most slowdowns are actually due to swap-thrashing issues). Matplotlib can be used for large data, but there exists some speciality tools for the truly large datasets. The solution depends on the situation. Ben Root On Mon, Sep 8, 2014 at 7:45 AM, Raffaele Quarta raffaele.qua...@linksmt.it wrote: Hi, I'm working with NetCDF format. When I try to make a plot of very large file, I have to wait for a long time for plotting. How can I solve this? Isn't there a solution for this problem? Raffaele -- This email was Virus checked by Astaro Security Gateway. http://www.sophos.com -- Want excitement? Manually upgrade your production database. When you want reliability, choose Perforce Perforce version control. Predictably reliable. http://pubads.g.doubleclick.net/gampad/clk?id=157508191iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- This email was Virus checked by Astaro Security Gateway. http://www.sophos.com -- Want excitement? Manually upgrade your production database. When you want reliability, choose Perforce Perforce version control. Predictably reliable. http://pubads.g.doubleclick.net/gampad/clk?id=157508191iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Jody Klymak http://web.uvic.ca/~jklymak/ -- Want excitement? Manually upgrade your production database. When you want reliability, choose Perforce Perforce version control. Predictably reliable. http
Re: [Matplotlib-users] Make clear figure used in the powerpoint slides?
On Apr 23, 2014, at 8:35 AM, Chao YUE chaoyue...@gmail.com wrote: yes, Ben, I understand the difference now. To Mike: I have to select the region of the figure I need in the pdf file and paste it in the powerpoint ... Isn't this you're doing as well? Why do you need to select a region? This takes a screen grab that will be terrible quality, doesn't it? Just drag the file into powerpoint (or use insert/picture). If you need to crop the PDF do that in Acrobat, or whatever PDF software you use. Cheers, Jody But fine, I can go with the current quality. Thanks to you all for this discussion. Cheers, Chao On Tue, Apr 22, 2014 at 3:31 PM, Benjamin Root ben.r...@ou.edu wrote: Yes, there is a difference if you use the button versus explicitly stating the dpi in a savefig call. When you use the button, matplotlib has to use the default dpi since there is no other way to specify it. Cheers! Ben Root On Mon, Apr 21, 2014 at 5:03 PM, Chao YUE chaoyue...@gmail.com wrote: Yes, in fact I set dpi as 1000, which is already very high. In fact I have another question, will there be any difference if I use the save button on the interactive plotting toolbar and use the command line figure.savefig('xx.png',dpi=1000)? Chao On Mon, Apr 21, 2014 at 10:59 PM, Jody Klymak jkly...@uvic.ca wrote: Did you set the dpi of the png? Cheers, Jody On Apr 21, 2014, at 13:50 PM, ChaoYue chaoyue...@gmail.com wrote: OK, I tried but I don't really see the difference between jpg and png by my eyes in the attached case, maybe for other more complicated plots there will be real difference. Anyway, thanks to all for your nice discussions. And, BTW, I tried 2 hours trying to find a way to convert svg to emf, but now I konw :p Cheers, Chao On Mon, Apr 21, 2014 at 9:49 PM, Benjamin Root-2 [via matplotlib] [hidden email] wrote: JPGs will *always* have bit blur as it is a lossy image format. PNGs would be a better bet. Ben Root On Mon, Apr 21, 2014 at 3:33 PM, ChaoYue [hidden email] wrote: Hi all, Thank you all for your kind response. I am sorry, but none of these solutions significantly improved the visual quality on microsoft powerpiont 2007. Thought I didn't try eps. So probably l have to go with the current quality. here is a best case I have now: https://www.dropbox.com/s/0uhjogalz92hssm/different_figure_example.pptx You can still see the a bit blur everywhere (currently with jpg being inserted directly). I didn't have better quality than this one by trying the method as suggested by you. Let me know if I am raising too much high demand for this. Cheers, Chao On Mon, Apr 21, 2014 at 4:41 PM, Jonathan Slavin [via matplotlib] [hidden email] wrote: Another alternative, if a vector graphics format doesn't work, is to make your png figure large. Then when you shrink it down to fit in your slide, it should still have good resolution. Jon On Mon, Apr 21, 2014 at 10:13 AM, [hidden email] wrote: No Powerpoint version I know supports SVG (or any vector graphics format useful in this case) and Matplotlib does not export WMF graphics anymore. So the easiest way is to use PNGs, if you can live with raster graphics. Alternatively, if you need vector graphics, you can export the Matplotlib plot as SVG and convert it to WMF or EMF using Inkscape. This can be done in the command line like this: c:\Program Files\Inkscape-0.48\inkscape.exe --without-gui --export-emf=output.emf input.svg Juergen -- Jonathan D. Slavin Harvard-Smithsonian CfA [hidden email] 60 Garden Street, MS 83 phone: a href=tel:%28617%29%20496-7981 value=a href=tel:%2B16174967981 value=+16174967981 target=_blank+16174967981 target=_blank(617) 496-7981 Cambridge, MA 02138-1516 fax: a href=tel:%28617%29%20496-7577 value=a href=tel:%2B16174967577 value=+16174967577 target=_blank+16174967577 target=_blank(617) 496-7577USA -- Start Your Social Network Today - Download eXo Platform Build your Enterprise Intranet with eXo Platform Software Java Based Open Source Intranet - Social, Extensible, Cloud Ready Get Started Now And Turn Your Intranet Into A Collaboration Platform http://p.sf.net/sfu/ExoPlatform ___ Matplotlib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/matplotlib-users If you reply to this email, your message will be added to the discussion below: http://matplotlib.1069221.n5.nabble.com/Make-clear-figure-used-in-the-powerpoint-slides-tp43252p43262.html To start a new topic under matplotlib - users, email [hidden email] To unsubscribe from matplotlib, click
Re: [Matplotlib-users] Make clear figure used in the powerpoint slides?
Did you set the dpi of the png? Cheers, Jody On Apr 21, 2014, at 13:50 PM, ChaoYue chaoyue...@gmail.com wrote: OK, I tried but I don't really see the difference between jpg and png by my eyes in the attached case, maybe for other more complicated plots there will be real difference. Anyway, thanks to all for your nice discussions. And, BTW, I tried 2 hours trying to find a way to convert svg to emf, but now I konw :p Cheers, Chao On Mon, Apr 21, 2014 at 9:49 PM, Benjamin Root-2 [via matplotlib] [hidden email] wrote: JPGs will *always* have bit blur as it is a lossy image format. PNGs would be a better bet. Ben Root On Mon, Apr 21, 2014 at 3:33 PM, ChaoYue [hidden email] wrote: Hi all, Thank you all for your kind response. I am sorry, but none of these solutions significantly improved the visual quality on microsoft powerpiont 2007. Thought I didn't try eps. So probably l have to go with the current quality. here is a best case I have now: https://www.dropbox.com/s/0uhjogalz92hssm/different_figure_example.pptx You can still see the a bit blur everywhere (currently with jpg being inserted directly). I didn't have better quality than this one by trying the method as suggested by you. Let me know if I am raising too much high demand for this. Cheers, Chao On Mon, Apr 21, 2014 at 4:41 PM, Jonathan Slavin [via matplotlib] [hidden email] wrote: Another alternative, if a vector graphics format doesn't work, is to make your png figure large. Then when you shrink it down to fit in your slide, it should still have good resolution. Jon On Mon, Apr 21, 2014 at 10:13 AM, [hidden email] wrote: No Powerpoint version I know supports SVG (or any vector graphics format useful in this case) and Matplotlib does not export WMF graphics anymore. So the easiest way is to use PNGs, if you can live with raster graphics. Alternatively, if you need vector graphics, you can export the Matplotlib plot as SVG and convert it to WMF or EMF using Inkscape. This can be done in the command line like this: c:\Program Files\Inkscape-0.48\inkscape.exe --without-gui --export-emf=output.emf input.svg Juergen -- Jonathan D. Slavin Harvard-Smithsonian CfA [hidden email] 60 Garden Street, MS 83 phone: a href=tel:%28617%29%20496-7981 value=a href=tel:%2B16174967981 value=+16174967981 target=_blank+16174967981 target=_blank(617) 496-7981 Cambridge, MA 02138-1516 fax: a href=tel:%28617%29%20496-7577 value=a href=tel:%2B16174967577 value=+16174967577 target=_blank+16174967577 target=_blank(617) 496-7577USA -- Start Your Social Network Today - Download eXo Platform Build your Enterprise Intranet with eXo Platform Software Java Based Open Source Intranet - Social, Extensible, Cloud Ready Get Started Now And Turn Your Intranet Into A Collaboration Platform http://p.sf.net/sfu/ExoPlatform ___ Matplotlib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/matplotlib-users If you reply to this email, your message will be added to the discussion below: http://matplotlib.1069221.n5.nabble.com/Make-clear-figure-used-in-the-powerpoint-slides-tp43252p43262.html To start a new topic under matplotlib - users, email [hidden email] To unsubscribe from matplotlib, click here. NAML -- please visit: http://www.globalcarbonatlas.org/ *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16 View this message in context: Re: Make clear figure used in the powerpoint slides? Sent from the matplotlib - users mailing list archive at Nabble.com. -- Start Your Social Network Today - Download eXo Platform Build your Enterprise Intranet with eXo Platform Software Java Based Open Source Intranet - Social, Extensible, Cloud Ready Get Started Now And Turn Your Intranet Into A Collaboration Platform http://p.sf.net/sfu/ExoPlatform ___ Matplotlib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Start Your Social Network Today - Download eXo Platform Build your Enterprise Intranet with eXo Platform Software Java Based Open Source
[Matplotlib-users] View just an angled part of an axis?
Hi all, I have some pcolormesh data that is in a thin strip along a slope at a (say) 45 degree angle.Is there a way to set up a view of data just within dz of the slope, following the slope? I would then stack successive views of this data. I tentatively tried something like: pcm=pcolormesh(x,z,Ep,rasterized=True,cmap=jet,vmin=-13,vmax=-5) rect = Rectangle((1,-8),10,4, facecolor=none, edgecolor=k,angle=-45) gca().add_artist(rect) pcm.set_clip_path(rect) But that doesn't clip properly. Note, I don't really want to rotate the data (that would be easy enough). I'd still prefer there was the sense of a slope relative to the horizontal. Thanks for any thoughts... Cheers, Jody -- Subversion Kills Productivity. Get off Subversion Make the Move to Perforce. With Perforce, you get hassle-free workflows. Merge that actually works. Faster operations. Version large binaries. Built-in WAN optimization and the freedom to use Git, Perforce or both. Make the move to Perforce. http://pubads.g.doubleclick.net/gampad/clk?id=122218951iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] x axis non-uniform labeling (KURT PETERS)
On Oct 1, 2013, at 10:55 AM, KURT PETERS petersk...@msn.com wrote: Goyo, Thanks, the code below seems to work. The problem is that with REAL/actual data, I have SO many data points that each point is now labeled and it takes forever to render. And when it does render, I cannot read the axis because there are too many there. Is there a way to judiciously have it only display a certain number of values? Such as every 100th value? Kurt ax2.set_xticks(xdat) ax2.set_xticklabels(simtimedata) ax2.set_xticks(xdat[::100]) ax2.set_xticklabels(simtimedata[::100]) Cheers, Jody -- Jody Klymak http://web.uvic.ca/~jklymak/ -- October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60134791iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] curtain plots
Hi All, To follow up on my own post - because my curtains and contours were well-ordered, I simply set the zorder on each call and got the right effect. Thanks, Jody On Sep 25, 2013, at 15:15 PM, Jody Klymak jkly...@uvic.ca wrote: Hi all, I am trying to make 3-D curtain plots. Basically, x,y are N-vectors, z is an M-vector, and C is MxN data set collected on the path with z. Application is a ship's track through the ocean. I also want to be able to contour a second variable C2 also MxN. I know how to do that, but the example below just uses plot3D, because thats how I do the curtain contouring. If I plot three such curtains they look OK, including the magenta line in each. If I plot a fourth, the magenta line is obscured by the curtain, and so on for more curtains. bad3dslices.png Any clue what the problem is? The code for this example is below, and I think is self contained, plus or minus running in pylab. Thanks, Jody from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm import matplotlib.pyplot as plt import numpy as np n=0 fig = figure() for Nn in array([3,4]): n=n+1 ax = fig.add_subplot(2,1,n,projection='3d') for off in arange(0,Nn*2,2)*50.: x = np.arange(-5, 5, .5) y = np.arange(-5, 5, .5) Z = np.arange(0,200,1) Z=np.tile(np.reshape(Z,(200,1)),(1,size(y))) X = np.tile(y,(200,1)) Y = np.tile(y,(200,1)) N = X*Y*Z N = N/N.max() # normalize 0..1 surf = ax.plot_surface( X+off, Y, Z, rstride=20, cstride=4, facecolors=cm.jet(N), linewidth=0, antialiased=False, shade=False,alpha=0.9) ax.plot(x+off+0.001,y,(y+5)*25.,'m') ax.set_xlim([-50,350]) ax.set_ylim([-8.,8.]) fig.savefig('doc/bad3dslices.png',res=72) -- Jody Klymak http://web.uvic.ca/~jklymak/ -- October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60133471iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Jody Klymak http://web.uvic.ca/~jklymak/ -- October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60133471iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] change the EPS font type ... afterwards!
On Sep 24, 2013, at 9:12 AM, Benjamin Root ben.r...@ou.edu wrote: ne thing I try to do with my projects is to separate the graph production from the data processing. I would have the data processing save the relevant data, and then have separate scripts that would generate graphs from that data. Second this - if it takes longer than 30s to run the processing, then I save the output and reload it to do the plotting. If you want the processing and plotting in the same file (or ipython Notebook, like I do) then consider putting an if 0: statement in front of the processing. If you want to run it again later, you just change to an if 1:. This approach lets you play with plots w/o reprocessing all the time. Cheers, Jody -- Jody Klymak http://web.uvic.ca/~jklymak/ -- October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60133471iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plot_surface does not work
Hi All, On Dec 11, 2012, at 16:59 PM, Damon McDougall damon.mcdoug...@gmail.com wrote: On Tue, Dec 11, 2012 at 1:16 PM, Benjamin Root ben.r...@ou.edu wrote: On Tue, Dec 11, 2012 at 2:08 PM, Chloe Lewis chle...@berkeley.edu wrote: Would it be workable for the default to be proportional to the size of the array passed in? (suggested only because I do that myself, when deciding how coarse an investigative plot I can get away with.) C That is pretty much what the PR I was referring to does: https://github.com/matplotlib/matplotlib/pull/1040 It makes it so that the behavior of both plot_surface and plot_wireframe is the same in this respect. So, by default, the rstride and cstride would be 1% of the size of your data array. This would make the default for the recent example be 1, therefore showing every point. I wonder if a logarithmic default would make sense to better handle large data arrays? Thoughts? Ben Root I hope nobody minds if I chime in here. I'm in favour of making the defaults a little more intelligent that what is implemented at present, i.e, a constant stride for any surface. Any non-trivial scaling law to determine what stride to use will result in more expected behaviour than what our users are currently seeing. Could we do better? Could we have plot_surface try and estimate the stride based on the 'roughness' of the surface to be plotted? This method would grind to a halt for very rough surfaces, so we could default to a scaling law in these cases. OK, way late here, but 1) I wasted an hour today before I discovered what rstride and cstride were. Reading the documentation, I still don't actually know what they are, except that if I want to see all my data I need to set them to 1. Array row stride (step size), is pretty enigmatic! stride is a term I've never heard before except is reference to walking. I see it is used in computer science, but to refer to the byte-wise distance between array elements, so not very analogous. Can I suggest the docs be improved to say exactly what these do (I assume either average over cstride columns and rstride rows, or subsample on that frequency, not clear which)? Can I also suggest the default is 1? Its pretty frustrating for large a chunk of your data to not show up for no logical reason. If my data set is too large, I am smart enough to subsample it myself before I plot it. 2) Can I suggest this example be added to the tutorial? http://stackoverflow.com/questions/6539944/color-matplotlib-plot-surface-command-with-surface-gradient None of the other examples explain how to colour your surface with data, which is what I wanted. 3) I think plot_surface should accept a fourth (optional) argument C for colouring the faces: plot_surface(X,Y,Z,C). I do this a lot if I want to make a 3-D plot, and normalizing C, clipping it, and indexing a colormap seem clunky, when the routine could do it for me. Thanks, Jody -- Jody Klymak http://web.uvic.ca/~jklymak/ -- October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60133471iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Asking for help modifying a matplot windrose graphic using Python (:
Hi Guilherme On Jul 22, 2013, at 20:54 PM, Guilherme Araújo Martins gami...@globo.com wrote: Basically, I'm using this code... http://matplotlib.org/examples/pylab_examples/polar_bar.html ... but I want to turn it in something like this graphic over here... http://www.weathersa.co.za/web/images/articles/windrose.png You see, where more than one bar pointing the same direction will be put one over the other (the biggest in the base and the smallest at the top). I assumed I had to put some function at this part of the code: bars = ax.bar(theta, radii, width=width, bottom=0.0) Turning Bottom into a function call somewhat related to the radii (bar size) if both bars have the same theta (angle). Point is I'm having some trouble doing that. I'm totally stuck, actually. For each direction, just plot the largest one first, and the smallest one last and set_alpha = 1. Cheers, Jody -- Jody Klymak http://web.uvic.ca/~jklymak/ -- See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] numpy masked array plot - isolated single unmasked value is hidden
Or make a stairstep, if each time has a finite duration. like the following (though I am sure there are some inelegant code in there. data = np.arange(10) mask = [0,0,0,1,1,0,1,0,0,0] x = np.ma.masked_array(data, mask) t = arange(-0.5,shape(x)[0]-0.5,1.) xx=ma.zeros((2,10)) xx[0,:]=x xx[1,:]=x tt=0.*xx tt[0,:]=t tt[1,:]=t+0.999 tt=reshape(tt,(20),order='F') xx=reshape(xx,(20),order='F') plot(tt,xx) On Jul 17, 2013, at 7:45 AM, Gregorio Bastardo gregorio.basta...@gmail.com wrote: Hi, The following example demonstrates the problem, value 5 could not be seen w/o marker: data = np.arange(10) mask = [0,0,0,1,1,0,1,0,0,0] x = np.ma.masked_array(data, mask) plot(x) plot(x, '+') In my datasets, isolated unmasked values are rare, but placing a marker to spot them makes the whole graph cluttered. I do realize that at least 2 valid points are needed for a line segment, but still, is there any way to visualize these isolated unmasked values w/o a marker? Thanks, Gregorio -- See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Jody Klymak http://web.uvic.ca/~jklymak/ -- See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Projection Direction Distortion
Hi Mat, On Apr 26, 2013, at 3:03 AM, Mathew Topper mathew.top...@ed.ac.uk wrote: I have a set of wave directions in lon lat, Not clear how a direction is given as a lon lat. Do you mean you have a set of vectors, each defined as lon/lat pairs? but I want to display them in a UTM type projection. I believe the directions will be distorted, but I'm not sure by how much. It depends on what you want - if you want the arrow to point where the wind would go after X minutes, then you want the distortion. If you want the viewer to be able to pick off the geographic heading by eye, then simply convert your lon lat pairs to heading/length pairs and plot them in the axis frame. See http://matplotlib.org/basemap/users/mapcoords.html for how to convert from basemap to the underlying axis frame. In an ideal world your projection would not be over such a large area that any of this matters - if your vector is off by 1 degree, who will be able to tell in a plot? Cheers,Jody -- Jody Klymak http://web.uvic.ca/~jklymak/ -- Try New Relic Now We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] cpt-city colormaps for matplotlib
Not quite a module, but I think it does what you want: http://matplotlib.1069221.n5.nabble.com/function-to-create-a-colormap-from-cpt-palette-td2165.html Cheers, Jody On Apr 24, 2013, at 9:16 AM, Andreas Hilboll li...@hilboll.de wrote: Hi, I'd like to have the cpt-city colormaps available in matplotlib. Is there already a module for this? If not, I'll try to patch something together. What do you think? Cheers, Andreas -- Try New Relic Now We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Jody Klymak http://web.uvic.ca/~jklymak/ -- Try New Relic Now We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] native latex rendering:
Hi All, rc('text', usetex=False) plot(arange(1,50)) title(' Boo Whoo') xlabel('$t\ [m^2s^{-1}]$') Works OK, except the x label is typeset in a different font than the rest due to the latex rc('text', usetex=False) rc('text.latex',preamble=\usepackage{cmbright}) plot(arange(1,50)) title(' Boo Whoo') xlabel('$t\ [m^2s^{-1}]$') Looks pretty good, though I prefer the default fonts, but it takes a long time for all the rendering. Is there a better solution to the first case that makes the fonts look more consistent? Thanks, Jody -- Jody Klymak http://web.uvic.ca/~jklymak/ -- Own the Future-Intelreg; Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] pcolormesh and clim?
Hi Eric, The docs seem to indicate clim is an acceptable kwarg, hence my confusion... http://matplotlib.org/api/pyplot_api.html?highlight=pcolormesh#matplotlib.pyplot.pcolormesh Thanks, Jody On Mar 28, 2013, at 11:12 AM, Eric Firing efir...@hawaii.edu wrote: On 2013/03/28 7:56 AM, Jody Klymak wrote: Hi all, In 1.2.0: pcolormesh(x,z,U,rasterized='True',cmap=cm.RdBu_r,clim=(-1.,1.)) Jody, There is no clim kwarg, only a clim pyplot function. You can do this, though: pcolormesh(..., vmin=-1, vmax=1) Eric #clim((-1.,1.)) Doesn't seem to work, where as pcolormesh(x,z,U,rasterized='True',cmap=cm.RdBu_r,clim=(-1.,1.)) clim((-1.,1.)) does work. Is this a bug or am I misunderstanding clim in the context of pcolormesh? Thanks, Jody -- Jody Klymak http://web.uvic.ca/~jklymak/ -- Own the Future-Intelreg; Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Own the Future-Intelreg; Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Jody Klymak http://web.uvic.ca/~jklymak/ -- Own the Future-Intelreg; Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Squashed axes with AxesGrid
...and did aspect=False not give you what you want? From what I can see http://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html#axes-grid1 contradicts itself, and the chart is correct and the description below incorrect. FWIW, I would expect the default to be False as well, but who am I to say? Cheers, Jody On Mar 22, 2013, at 9:52 AM, Steven Boada bo...@physics.tamu.edu wrote: Sorry y'all. I can see the confusion. I started with AxesGrid -- squashed. JJ suggested Grid and that fixes the scaling problems. I realized that using just plain Grid doesn't give me the nice controls over the colorbars (which I would like to have), so I wrote a simple script and emailed it back out. That did include AxesGrid. According to the manual ( http://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html#axes-grid1 )... aspect By default (False), widths and heights of axes in the grid are scaled independently. If True, they are scaled according to their data limits (similar to aspect parameter in mpl). Which I read as it should scale the widths and heights should not be squashed. But what Ben is telling me (thanks for the explanation) is that isn't true. Seems like there is something simple I am just missing. Sorry for that bit of confusion. Steven On Fri Mar 22 11:39:46 2013, Benjamin Root wrote: On Fri, Mar 22, 2013 at 12:30 PM, Steven Boada bo...@physics.tamu.edu mailto:bo...@physics.tamu.edu wrote: Well... I jumped the gun. To better illustrate the problem(s) I am having, I wrote a simple script that doesn't work... import pylab as pyl from mpl_toolkits.axes_grid1 import AxesGrid # make some data xdata = pyl.random(100) * 25. ydata = pyl.random(100) * 8. colordata = pyl.random(100) * 3. # make us a figure F = pyl.figure(1,figsize=(5.5,3.5)__) grid = AxesGrid(F, 111, nrows_ncols=(1,2), axes_pad = 0.1, add_all=True, share_all = True, cbar_mode = 'each', cbar_location = 'top') # Plot! sc1 = grid[0].scatter(xdata, ydata, c=colordata, s=50, cmap='spectral') sc2 = grid[1].scatter(xdata, ydata, c=colordata, s=50, cmap='spectral') # Add colorbars grid.cbar_axes[0].colorbar(__sc1) grid.cbar_axes[1].colorbar(__sc2) grid[0].set_xlim(0,25) grid[0].set_ylim(0,8) pyl.show() And you get some squashed figures... I'll attach a png. Thanks again. Steven You used AxesGrid again, not Grid. AxesGrid implicitly applies an aspect='equal' to the subplots. This means that a unit of distance on the x-axis takes the same amount of space as the same unit of distance on the y-axis. In your example, the x axis goes from 0 to 25, while the y-axis goes from 0 to 8. When aspect='equal', the y-axis will then be about a third the size of the x-axis, because the y-limits are about a third the size of the x-limits. Ben Root -- Steven Boada Doctoral Student Dept of Physics and Astronomy Texas AM University bo...@physics.tamu.edu -- 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_mar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Jody Klymak http://web.uvic.ca/~jklymak/ -- 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_mar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] matching axes lengths after calls to set_aspect and colorbar
Hi All, I want to have two axes have the same xlimits and the same length of the x axis. However, I'd also like for the first axis to be plotted at a certain aspect ratio (its geographic if anyone is interested). The following two tries do not work, because the bounds stay the same after set_aspect. I'm sure I'm just missing some other call to the axes (or axis?) class. Is there someway at getting at the underlying length of the actual axis, not its whole bounding box? Thanks, Jody # this basically has no effect ax=subplot(2,1,1) plot(arange(0,10),arange(0,10)*3) ax.set_aspect(0.7) pp = ax.get_position().bounds axn=subplot(2,1,2) plot(arange(0,10),rand(10)) ppn = axn.get_position().bounds print pp print ppn axn.set_position([pp[0],ppn[1],pp[2],ppn[3]]) # Or, this zooms in on subplot 1, which is of course not what I want ax=subplot(2,1,1) plot(arange(0,10),arange(0,10)*3) ax.set_aspect(0.7) pp = ax.get_position().bounds axn=subplot(2,1,2,sharex=ax) plot(arange(0,10),rand(10)) ppn = axn.get_position().bounds print pp print ppn axn.set_position([pp[0],ppn[1],pp[2],ppn[3]]) -- Jody Klymak http://web.uvic.ca/~jklymak/ -- Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester Wave(TM): Endpoint Security, Q1 2013 and remains a good choice in the endpoint security space. For insight on selecting the right partner to tackle endpoint security challenges, access the full report. http://p.sf.net/sfu/symantec-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matching axes lengths after calls to set_aspect and colorbar
Hi Eric, On Mar 7, 2013, at 14:42 PM, Eric Firing efir...@hawaii.edu wrote: I think there is a simpler way. Does this do what you want? fig, axs = plt.subplots(nrows=2, sharex=True) axs[0].set_aspect(0.7, adjustable='datalim') axs[0].plot(np.random.rand(5)) axs[1].plot(np.random.rand(7)) plt.show() Note that when you set the aspect, it is not applied until there is a draw() operation. Not quite, but the fact that I need to call get_position after a draw() call does help. The below works, though simpler ways are very welcome. Your method zoomed out the first plot's ylimits rather than shrunk the second plot's x axis size, which isn't what I want if the first plot is geographic. Thanks, Jody lonz=arange(40.,42.,0.1) latz = arange(38.,40.,0.1) lons = arange(40.,42.,0.3) dats = rand(shape(lons)[0]) Z = rand(shape(latz)[0],shape(lonz)[0]) ax=subplot2grid((3,1),(0,0),rowspan=2) pcolormesh(lonz,latz,Z) ax.set_aspect(cos(39*pi/180.)) draw() pp=ax.get_position().bounds xl=ax.get_xlim() axn=subplot2grid((3,1),(2,0)) plot(lons,dats) ppn = axn.get_position().bounds axn.set_position([pp[0],ppn[1],pp[2],ppn[3]]) xlim(xl) -- Jody Klymak http://web.uvic.ca/~jklymak/ -- Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester Wave(TM): Endpoint Security, Q1 2013 and remains a good choice in the endpoint security space. For insight on selecting the right partner to tackle endpoint security challenges, access the full report. http://p.sf.net/sfu/symantec-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] depth longitude plot
Hi Sudheer, You want contourf. http://matplotlib.org/examples/pylab_examples/contour_image.html Cheers, Jody On Mar 4, 2013, at 9:04 AM, Sudheer Joseph sudheer.jos...@yahoo.com wrote: Hi Benamin, I was looking for a plot similar to the attached one named ferret.gif. But from matplot lib I get flat fill and contours which are not aligned to the levels ( named figure_1.png , it looks like matplotlib has just flat surfaces as it used pcolor. with best regards, Sudheer From: Sudheer Joseph sudheer.jos...@yahoo.com To: Benjamin Root ben.r...@ou.edu Cc: Matplotlib-users@lists.sourceforge.net matplotlib-users@lists.sourceforge.net Sent: Monday, 4 March 2013 8:19 PM Subject: Re: [Matplotlib-users] depth longitude plot Thank you, I just posted this question in numpy lists thinking that it is possible after regriding the data to new axes. Thanks for the help. with best regards, Sudheer *** Sudheer Joseph Indian National Centre for Ocean Information Services Ministry of Earth Sciences, Govt. of India POST BOX NO: 21, IDA Jeedeemetla P.O. Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55 Tel:+91-40-23886047(O),Fax:+91-40-23895011(O), Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) E-mail:sjo.in...@gmail.com;sudheer.jos...@yahoo.com Web- http://oppamthadathil.tripod.com *** From: Benjamin Root ben.r...@ou.edu To: Sudheer Joseph sudheer.jos...@yahoo.com Cc: Phil Elson pelson@gmail.com; Matplotlib-users@lists.sourceforge.net matplotlib-users@lists.sourceforge.net Sent: Monday, 4 March 2013 7:53 PM Subject: Re: [Matplotlib-users] depth longitude plot On Sat, Mar 2, 2013 at 6:35 AM, Sudheer Joseph sudheer.jos...@yahoo.com wrote: Hi Phil, Though iris looked to be promising it needed many other libraries, so I chose the below suggestion. But is there a way to overlay contours on this ? also is it possible to specify the levels? In [23]: plt.pcolormesh?? did not give much help with best regards, Sudheer You can overlay contours on the pcolormesh image by simply using the plt.contour() function after the pcolormesh() call. It allows you to control which levels to contour and you can specify the attributes of those contours like the color or thickness. Note that unlike Matlab, you don't have to call hold on between plots. By default, matplotlib will hold. I hope that helps! Ben Root -- 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 ferret.giffigure_1.png-- 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 -- Jody Klymak http://web.uvic.ca/~jklymak/ -- 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
Does xticks not do what you want? Maybe I am misundertsanding because you are trying to do something with a raw Artist... http://matplotlib.org/api/pyplot_api.html?highlight=xticks#matplotlib.pyplot.xticks Cheers, Jody On Feb 20, 2013, at 10:31 AM, patricia ptramba...@hotmail.com wrote: Hi, I am working on a plot that requires AxisArtist and I cannot set the tick separation (or nbins) that I want to avoid overlapping of ticklabels. I read http://www.ce.mu.edu.tr/sharedoc/python-matplotlib-doc-1.0.1/html/mpl_toolkits/axes_grid/users/axisartist.html#gridhelper, where they suggest to use the classical set_ticks, but it doesn't work. ax.xaxis.set_ticks() does not makes any difference, the ticks are same as originally, and ax.axis[left].set_ticks() results in an error: 'AxisArtist' object has no attribute 'set_ticks' Can somebody help me? Thanks in advance, Patricia -- View this message in context: http://matplotlib.1069221.n5.nabble.com/I-cannot-change-the-axis-tick-separation-or-nbins-in-Axis-artist-tp40446.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 -- Jody Klymak http://web.uvic.ca/~jklymak/ -- 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
Perhaps you could include some code that illustrates what you are trying to do? I'm confused if you are trying to do something simple and are just going about it the wrong way, or if you are doing something hard. If I do ax=axes() ax.plot(arange(1.,10.)) xticks(range(0,10,2)) yticks(range(0,10,2)) I get ticks every 2 points. Thanks, Jody On Feb 20, 2013, at 11:34 AM, patricia ptramba...@hotmail.com wrote: Dear Jody, No, I tried it also... ax.axis[left].xticks() results in error: 'AxisArtist' object has no attribute 'xticks' ax.xticks() results in error: 'Floating AxesHostAxesSubplot' object has no attribute 'xticks' plt.xticks() or just xticks() does not produce any change. Any idea? http://www.ce.mu.edu.tr/sharedoc/python-matplotlib-doc-.0.1/html/mpl_toolkits/axes_grid/users/axisartist.html#gridhelper gives some explanation with the The GridHelperRectlinear, but I cannot make it work 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-tp40446p40448.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 -- Jody Klymak http://web.uvic.ca/~jklymak/ -- 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] rasterized colorbar
On Oct 28, 2012, at 17:47 PM, Eric Firing efir...@hawaii.edu wrote: cb = colorbar() cb.solids.set_rasterized(True) Great! Though I think it'd have taken me a while to figure that one out! Thanks, Jody -- Jody Klymak http://web.uvic.ca/~jklymak/ -- The Windows 8 Center - In partnership with Sourceforge Your idea - your app - 30 days. Get started! http://windows8center.sourceforge.net/ what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] rasterized colorbar
Hi all, So I figured out the magic of rasterized=True, which is *really* helpful! However, the colorbar doesn't seem to accept rasterized=True, so there are little lines every facet (zoom on the attached pdf). Is there another way to get the colorbar colors rasterized? Thanks Jody x = linspace(0,1,1000) X = outer(x,x) pcolormesh(X,cmap=get_cmap('RdBu_r',lut=32),rasterized=True) colorbar() savefig('Test.pdf',dpi=50) Test.pdf Description: Adobe PDF document -- Jody Klymak http://web.uvic.ca/~jklymak/ -- WINDOWS 8 is here. Millions of people. Your app in 30 days. Visit The Windows 8 Center at Sourceforge for all your go to resources. http://windows8center.sourceforge.net/ join-generation-app-and-make-money-coding-fast/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Options for speeding up matplotlib, spectrogram with log scale axis, etc.
Hi Eric, The pcolormesh docstring notes that it is much faster than pcolor; the pcolor docstring probably should refer people to pcolormesh, since matlab users are likely to go straight to pcolor without realizing that they should be using pcolormesh. I'd agree with this. pcolormesh is not even in the See Also, and there is no warning about the effciency of pcolor. I'd even go so far as to suggest that pcolor be deprecated so new users are more likely to find pcolormesh. Anyway, thanks for the pointer! Cheers, Jody -- Jody Klymak http://web.uvic.ca/~jklymak/ -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Options for speeding up matplotlib, spectrogram with log scale axis, etc.
is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Jody Klymak http://web.uvic.ca/~jklymak/ -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] python question from matlab user
Hi all, Thats what I thought too: I have: jmkfigure.py: === from pylab import * def jmkfigure(): rc('figure',figsize=(3+3/8,8.5/2),dpi=96) rc('font',size=9); === and test.py: = from pylab import * from jmkfigure import * jmkfigure() figure(1) plot([1,2,3]); show() == run test.py yields a traceback ending w/: === Users/jklymak/teaching/Phy411/project/jmkfigure.py in jmkfigure() 1 from pylab import * 2 3 def jmkfigure(): 4 rc('figure',figsize=(3+3/8,8.5/2),dpi=96) 5 rc('font',size=9); NameError: global name 'rc' is not defined Same error if I just import rc from matplot lib Is it some strange set up problem? If I put the same def in test.py it works fine... Thanks, Jody On Sep 7, 2012, at 22:52 PM, Paul Tremblay paulhtremb...@gmail.com wrote: in your jmkfile.py you should have from pylab import * Paul On 9/8/12 12:45 AM, Jody Klymak wrote: Hi All, Sorry to ask a dumb python newbie question, but the problem arose while reading the matplotlib documentation, and an hour or so on the internet didnt' help, so I felt it was fair-ish game to post here. In http://matplotlib.sourceforge.net/examples/pylab_examples/customize_rc.html it says: If you like to work interactively, and need to create different sets of defaults for figures (eg one set of defaults for publication, one set for interactive exploration), you may want to define some functions in a custom module that set the defaults, eg def set_pub(): rc('font', weight='bold')# bold fonts are easier to see Then as you are working interactively, you just need to do set_pub() Which I thought was great, because I'd like to have some presets for different journals. However, saving the def into a file (jmkfigure.py) and calling from jmkfigure import * set_pub() yields the error: NameError: global name 'rc' is not defined I tried importing matplotlib and rc into jmkfigure.py, but to no avail. I appreciate this is a scoping issue with python, but I can't figure out how to set rc from within an external module. Thanks for any help, Cheers, Jody -- 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 -- Jody Klymak http://web.uvic.ca/~jklymak/ -- 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] python question from matlab user
This is one of the big differences between python and matlab: in matlab, if an m-file has changed within a session, the change is immediately effective. The python import statement is very different. Gotchya, thanks. So, while I'm being a bother: in Matlab, I often organize data in structures as: adcp.time [1xN] adcp.z [Mx1] adcp.u [MxN] where time is the x-axis, z the z-axis and u an array of values at each depth and time (an example chosen after Eric's heart). What is the recommended way to represent this in python? I see the info about numpy structured arrays. Is that it? It also seems that Mx1 arrays are hard in python. It also seems you need to preallocate the whole array, which isn't very flexible compared to how you can do it in Matlab. Am I missing something? Thanks, Jody Sorry for the chatter, and thanks for the pointers.. Cheers, Jody On Sep 8, 2012, at 6:18 AM, Jody Klymak jkly...@uvic.ca mailto:jkly...@uvic.ca wrote: Hi all, Thats what I thought too: I have: jmkfigure.py: === from pylab import * def jmkfigure(): rc('figure',figsize=(3+3/8,8.5/2),dpi=96) rc('font',size=9); === and test.py: = from pylab import * from jmkfigure import * jmkfigure() figure(1) plot([1,2,3]); show() == run test.py yields a traceback ending w/: === Users/jklymak/teaching/Phy411/project/jmkfigure.py in jmkfigure() 1 from pylab import * 2 3 def jmkfigure(): 4 rc('figure',figsize=(3+3/8,8.5/2),dpi=96) 5 rc('font',size=9); NameError: global name 'rc' is not defined Same error if I just import rc from matplot lib Is it some strange set up problem? If I put the same def in test.py it works fine... Thanks, Jody On Sep 7, 2012, at 22:52 PM, Paul Tremblay paulhtremb...@gmail.com mailto:paulhtremb...@gmail.com wrote: in your jmkfile.py you should have from pylab import * Paul On 9/8/12 12:45 AM, Jody Klymak wrote: Hi All, Sorry to ask a dumb python newbie question, but the problem arose while reading the matplotlib documentation, and an hour or so on the internet didnt' help, so I felt it was fair-ish game to post here. Inhttp://matplotlib.sourceforge.net/examples/pylab_examples/customize_rc.html it says: If you like to work interactively, and need to create different sets of defaults for figures (eg one set of defaults for publication, one set for interactive exploration), you may want to define some functions in a custom module that set the defaults, eg def set_pub(): rc('font', weight='bold')# bold fonts are easier to see Then as you are working interactively, you just need to do set_pub() Which I thought was great, because I'd like to have some presets for different journals. However, saving the def into a file (jmkfigure.py) and calling from jmkfigure import * set_pub() yields the error: NameError: global name 'rc' is not defined I tried importing matplotlib and rc into jmkfigure.py, but to no avail. I appreciate this is a scoping issue with python, but I can't figure out how to set rc from within an external module. Thanks for any help, Cheers, Jody -- 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 mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Jody Klymak http://web.uvic.ca/~jklymak/ -- 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 mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Jody Klymak http://web.uvic.ca/~jklymak/ -- 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
[Matplotlib-users] python question from matlab user
Hi All, Sorry to ask a dumb python newbie question, but the problem arose while reading the matplotlib documentation, and an hour or so on the internet didnt' help, so I felt it was fair-ish game to post here. In http://matplotlib.sourceforge.net/examples/pylab_examples/customize_rc.html it says: If you like to work interactively, and need to create different sets of defaults for figures (eg one set of defaults for publication, one set for interactive exploration), you may want to define some functions in a custom module that set the defaults, eg def set_pub(): rc('font', weight='bold')# bold fonts are easier to see Then as you are working interactively, you just need to do set_pub() Which I thought was great, because I'd like to have some presets for different journals. However, saving the def into a file (jmkfigure.py) and calling from jmkfigure import * set_pub() yields the error: NameError: global name 'rc' is not defined I tried importing matplotlib and rc into jmkfigure.py, but to no avail. I appreciate this is a scoping issue with python, but I can't figure out how to set rc from within an external module. Thanks for any help, Cheers, Jody -- 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