Re: [Matplotlib-users] plot_surface does not work
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 On Dec 11, 2012, at 9:28 AM, Benjamin Root wrote: > > > On Tue, Dec 11, 2012 at 12:17 PM, Ethan Gutmann > wrote: > > This is because the default rstride and cstride arguments is 10, IIRC. > > Since your array is only 12x12, the surface plotting is barely plotting > > anything. Try calling: > > > > ax.plot_surface(x, y, a, rstride=1, cstride=1) > > > You know, this has tripped me up a few times too. I don't use plot_surface > often enough to always remember this, and it is not the first parameter I > think to check when debugging a program. Is there a reason the default > rstride and cstride aren't 1 other than possible memory constraints for large > arrays? > > I suppose changing the defaults might break programs that rely on this > behavior, but if this API ever gets revamped, consider this a request to make > 1 be the default instead. I would think that the default should be that the > obvious command "just works" while plots that may require too much memory can > be tweaked to work faster (I'm assuming that is the reason for the default of > 10). > > > I actually don't know the reason for the defaults (I didn't create mplot3d), > but that has always been my suspicion. There is an existing PR to change the > default behavior to be somewhat "automatic". At the time, I wasn't really in > favor of it, but when looked in this light, it does make some more sense. > > I'll have to think about this a bit more. > Ben Root > > -- > LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial > Remotely access PCs and mobile devices and provide instant support > Improve your efficiency, and focus on delivering more value-add services > Discover what IT Professionals Know. Rescue delivers > http://p.sf.net/sfu/logmein_12329d2d___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] how to express statistical data in colors
> > I think a histogram isn't the thing I need because it is not important > when (the time) the values between 60 and 90 have been "created". Only > the values and the amount of values is important. You can make the values the independent axis of the histogram. > > Also when talking about a colormap I'm not sure if this is required. In > the end I want only one color (blue) in a rectangle that changes the > color/appearance based on the density. So I guess to bluescale it is the > right way as you suggested. > I think custom blue scale can only be done as a custom colormap; but R and G will be constant throughout. &C -- LogMeIn Central: Instant, anywhere, Remote PC access and management. Stay in control, update software, and manage PCs from one command center Diagnose problems and improve visibility into emerging IT issues Automate, monitor and manage. Do more in less time with Central http://p.sf.net/sfu/logmein12331_d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] how to express statistical data in colors
You're translating a histogram of your data into a colormap, yes? The matplotlib histogram returns bins and patches, which you could translate into color intensities; but I bet scipy.stats.histogram would be easier. Then the bin centers are the segment boundaries of the colormap, and the weight in each bin is the respective color intensity. Also, color has a finite extent but the bin weight might not. You'll need to choose a nominal max value to norm the colors to, and decide whether to use the same max value all the time (so early plots might all be light, late plots all dark) or calculate it from the data each time you plot (in which case the colorbar this month might not mean the same thing as the color bar last month). I think using all three of RGB is too confusing -- do it bluescale or grayscale. &C On Nov 5, 2012, at 7:13 AM, ran...@0x06.net wrote: > Hi Chloe > > Thank you for answering. > > I agree the way you suggest. Currently I have done this: > > import matplotlib > import matplotlib.pyplot as plt > > # http://matplotlib.org/examples/api/colorbar_only.html > # > http://matplotlib.org/api/colors_api.html#matplotlib.colors.LinearSegmentedColormap > > > # The lookup table is generated using linear interpolation for each > primary color, with the 0-1 domain divided into any number of segments. > # x, y0, y1 > cdict = {'red': [(0.0, 0.0, 0.0), > (0.5, 1.0, 1.0), > (1.0, 1.0, 1.0)], > > 'green': [(0.0, 0.0, 0.0), > (0.25, 0.0, 0.0), > (0.75, 1.0, 1.0), > (1.0, 1.0, 1.0)], > > 'blue': [(0.0, 0.0, 0.0), > (0.5, 0.0, 0.0), > (1.0, 1.0, 1.0)]} > > # create colormap > my_cmap = matplotlib.colors.LinearSegmentedColormap("my_colormap", > cdict, N=256, gamma=1.0) > > # optional: register colormap > #plt.register_cmap(name='my_colormap', data=cdict) > > fig = plt.figure(figsize=(5,1)) > fig.subplots_adjust(top=0.99, bottom=0.01, left=0.2, right=0.99) > plt.axis("off") > import numpy as np > a = np.linspace(0, 1, 256).reshape(1,-1) > a = np.vstack((a,a)) > plt.imshow(a, aspect='auto', cmap=my_cmap, origin='lower') > > plt.show() > > Now the tricky part has still to be done. I have a varying number (ca. > 500, increasing) of values between 60 and 90. Those values must be > represented in the colorbar. White if there is no value, blue towards > black the more values are in the same area. > For this, I guess, I have to set a x for each value (and three x since > the color is calculated using RGB). And the closer it is to the previous > one the more I have to calculate the color between blue and black. > > Or do you suggest another way to implement this? > > I do not know of any other software that this issue has been implemented. > > cheers! > > > On 10/26/2012 07:47 PM, Chloe Lewis wrote: >> you'll be doing something like the second color bar, but making the >> boundary and color definitions a lot more flexible. Where the discrete >> color bar uses >> >> cmap = mpl.colors.ListedColormap(['r', 'g', 'b', 'c']) >> bounds = [1, 2, 4, 7, 8] >> >> you'll be making a whole LinearSegmentedColormap, see >> >> http://matplotlib.org/api/colors_api.html#matplotlib.colors.LinearSegmentedColormap >> >> and check out specifically the ascii-art explanation of interpolation >> between row[i] and row[i+1]. Red, green, blue will break based on your data >> density and how you want to express 'intensity'. And depending on whether >> you'll make it red-green-colorblindness neutral! >> >> Interesting problem. Has it been implemented in some other software? >> >> >> Chloe Lewis >> PhD candidate, Harte Lab >> Division of Ecosystem Sciences, ESPM >> University of California, Berkeley >> 137 Mulford Hall >> Berkeley, CA 94720 >> chle...@berkeley.edu <mailto:chle...@berkeley.edu> >> -- LogMeIn Central: Instant, anywhere, Remote PC access and management. Stay in control, update software, and manage PCs from one command center Diagnose problems and improve visibility into emerging IT issues Automate, monitor and manage. Do more in less time with Central http://p.sf.net/sfu/logmein12331_d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] how to express statistical data in colors
Chloe Lewis PhD candidate, Harte Lab Division of Ecosystem Sciences, ESPM University of California, Berkeley 137 Mulford Hall Berkeley, CA 94720 chle...@berkeley.edu Begin forwarded message: > From: Chloe Lewis > Subject: Re: [Matplotlib-users] how to express statistical data in colors > Date: October 26, 2012 10:47:54 AM PDT > To: ran...@0x06.net > > you'll be doing something like the second color bar, but making the boundary > and color definitions a lot more flexible. Where the discrete color bar uses > > cmap = mpl.colors.ListedColormap(['r', 'g', 'b', 'c']) > bounds = [1, 2, 4, 7, 8] > you'll be making a whole LinearSegmentedColormap, see > http://matplotlib.org/api/colors_api.html#matplotlib.colors.LinearSegmentedColormap > and check out specifically the ascii-art explanation of interpolation between > row[i] and row[i+1]. Red, green, blue will break based on your data density > and how you want to express 'intensity'. And depending on whether you'll make > it red-green-colorblindness neutral! > Interesting problem. Has it been implemented in some other software? > > Chloe Lewis > PhD candidate, Harte Lab > Division of Ecosystem Sciences, ESPM > University of California, Berkeley > 137 Mulford Hall > Berkeley, CA 94720 > chle...@berkeley.edu > -- 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
Re: [Matplotlib-users] How to plot a set of line segments
You can plot them all individually; e.g. rec = ([1,2,.5], [0.5, 3, 1.1], [5, 7, .2]) for r in rec: pylab.plot( r[:2], [r[2]]*2) On Dec 10, 2010, at 12:13 PM, John Salvatier wrote: > I have a set of records with (start, end, value) values. Basically > they represent "we had this value between these two times". The end > of one record is not necessarily the end of another record. > > I would like to plot a set of line segments with end points > (x=start, y= value) and (x=end, y=value), so I will have time on > the x axis and value on the y axis. > > Does anyone have any ideas on how I could do this? I would really > like my line segments not to be connected, so I don't want to use a > line plot or xyplot. > > Best Regards, > John Salvatier > -- > Oracle to DB2 Conversion Guide: Learn learn about native support for > PL/SQL, > new data types, scalar functions, improved concurrency, built-in > packages, > OCI, SQL*Plus, data movement tools, best practices and more. > http://p.sf.net/sfu/oracle-sfdev2dev > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL, new data types, scalar functions, improved concurrency, built-in packages, OCI, SQL*Plus, data movement tools, best practices and more. http://p.sf.net/sfu/oracle-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Two sets of ticks on a single colorbar?
I think the pretty-fying done in the Colorbar class will make this harder; at least, twiny on an existing colorbar doesn't work (overwrites original ticks); having two colorbars works fine but wastes space; and adding a spine had surprising side-effects (changed the color range!). I would guess that you want a custom Colorbar class, with a different offset for a second set of ticks. note that in colorbar.py, there's some code specific to CountourSets. &C On Nov 15, 2010, at 15 Nov, 8:22 AM, Daniel Welling wrote: Greetings. I am making some contour plots and in my field for this particular value, there are two widely used units. As such, it is very useful to have both units listed on the colorbar. To clarify: the colorbar's normal ticks would be facing to the right and labeled with Unit Type 1, which was the units that the data were in when they were plotted. Unit Type 2 is simply a factor of X different than unit type two. It would be nice if I could add a second set of ticks to the color bar using a different locator and have them face left. Is this possible? Is there another way to display two values for each tick such that the colorbar shows both units? Thanks. -dw -- Centralized Desktop Delivery: Dell and VMware Reference Architecture Simplifying enterprise desktop deployment and management using Dell EqualLogic storage and VMware View: A highly scalable, end-to-end client virtualization framework. Read more! http://p.sf.net/sfu/dell-eql-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users Chloe Lewis Ecosystem Sciences, Policy and Management, UC Berkeley 137 Mulford Hall Berkeley, CA 94720-3114 http://nature.berkeley.edu/~chlewis -- Centralized Desktop Delivery: Dell and VMware Reference Architecture Simplifying enterprise desktop deployment and management using Dell EqualLogic storage and VMware View: A highly scalable, end-to-end client virtualization framework. Read more! http://p.sf.net/sfu/dell-eql-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Images as markers in matplotlib?
There was a thread called "Placing images on figures" with a bunch of approaches... http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg17278.html On Sep 7, 2010, at 7 Sep, 2:34 PM, Joshua Holbrook wrote: > Hey y'all, > > I recently read about Chernoff faces > (http://en.wikipedia.org/wiki/Chernoff_face) in one of Edward Tufte's > books (great read btw) and would like to mess around with them in > matplotlib. My current approach is to generate the faces as images, > and then use them as markers on an x-y plot (like the example I > found in the Tufte book). I just realized, though, that I have no > idea how to > incorporate images as position markers in matplotlib, or if it's even > possible. My search of the mpl docs didn't turn up much. > > Any ideas? > > > --Joshua Holbrook > > -- > This SF.net Dev2Dev email is sponsored by: > > Show off your parallel programming skills. > Enter the Intel(R) Threading Challenge 2010. > http://p.sf.net/sfu/intel-thread-sfd > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users Chloe Lewis Ecosystem Sciences, Policy and Management, UC Berkeley 137 Mulford Hall Berkeley, CA 94720-3114 http://nature.berkeley.edu/~chlewis -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] citation of mpl
Well, I had my bib program open, so here are a couple formats: Everything.bibBibDesk117Hunter, John D.Matplotlib: A 2D graphics environmentComputing In Science \& Engineering9390--9510662 LOS VAQUEROS CIRCLE, PO BOX 3014, LOS ALAMITOS, CA 90720-1314 USAIEEE COMPUTER SOCEditorial Material2007May-JunHunter:2007http://gateway.isiknowledge.com/gateway/Gateway.cgi?GWVersion=2&SrcAuth=Alerting&SrcApp=Alerting&DestApp=WOS&DestLinkType=FullRecord;KeyUT=000245668100019Matplotlib is a 2D graphics package used for Python for application development, interactive scripting, and publication-quality image generation across user interfaces and operating systems.article23/09/201023/09/2010 matplotlib.ris Description: application/research-info-systems matplotlib.bib Description: Binary data On Sep 22, 2010, at 22 Sep, 1:18 PM, Benjamin Root wrote:On Wed, Sep 22, 2010 at 3:13 PM, Jason Groutwrote: On 09/22/2010 08:59 AM, John Hunter wrote: > On Wed, Sep 22, 2010 at 8:45 AM, Bala subramanian > wrote: >> Friends, >> I have mentioned in my research manuscript that plots were generated by >> 'matplotlib package'. I dnt find the related reference of mpl. Kindly tell >> me how can i site mpl. > You can certainly reference the website, but if you want to refer to a > published paper, I suggest > > Matplotlib: A 2D Graphics Environment > Source: Computing in Science and Engineering archive > Volume 9 , Issue 3 (May 2007) > Pages: 90-95 > Year of Publication: 2007 > ISSN:1521-9615 > Author:John D. Hunter > Publisher : IEEE Educational Activities Department Piscataway, NJ, USA > > and/or the conference abstract at > http://adsabs.harvard.edu/abs/2005ASPC..347...91B Could this be put up on the website somewhere in a easily-found place? Maybe a short sentence and link in the bar on the right under "Other stuff"? Something like "To cite matplotlib in a paper, use href=''> this reference." or something. Thanks, Jason +1...This would help by providing a consistent way of citing matplotlib. Without this, different authors may reference matplotlib different ways, thereby diluting the impact of the above reference. Plus, it always annoyed me to try and figure out how to cite things like matplotlib or various data sources. Ben Root --Start uncovering the many advantages of virtual appliancesand start using them to simplify application deployment andaccelerate your shift to cloud computing.http://p.sf.net/sfu/novell-sfdev2dev___Matplotlib-users mailing listMatplotlib-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/matplotlib-users Chloe LewisEcosystem Sciences, Policy and Management, UC Berkeley137 Mulford HallBerkeley, CA 94720-3114http://nature.berkeley.edu/~chlewis -- Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Ternary Plotting using Matplotlib
Lab Rat, Ben; Yes, you could use the ternary code I've put together to do the CAC plots in 2D; defining a complete triangular grid and triangular patches would be easy. If I'm reading the examples correctly, all the third-dimension information duplicates the color information. They're simpler than they look, Ben, which is part of their charm; we use them for any mixture of three elements where a+b+c is constant, so really they're 2D data. (Why bother, people ask? Because which of the elements is most interesting varies with the mixture and use, so we like having all three axes labeled. Note: many versions get one of the axes backwards.) &C On Sep 15, 2010, at 8:38 AM, Uri Laserson wrote: > I believe that Chloe Lewis may have posted about this before. She > has code for doing some ternary plotting type stuff that may be a > good place to start for you: > http://nature.berkeley.edu/~chlewis/Sourcecode.html > > Uri > > On Wed, Sep 15, 2010 at 11:23, Benjamin Root wrote: > On Tue, Sep 14, 2010 at 10:37 AM, Lab Rat wrote: > I saw some 3d ternary plots on the URL: > http://www.hca.com/index.php?id=76&L=0 > that I'd love to recreate using matplotlib. Can anyone give me > some general code examples of where I should likely begin? > Thanks in advance! > Wil > > > Ah, my wife showed me these plots once. odd little buggers... > > As far as I know, these plots are not available in matplotlib at the > moment. However, I might be persuaded to write up some code to do a > 2D version of it (3D version would come much, much later). If I > could get this to work, I might finally convince my wife to switch > from matlab/excel to python! > > Do you have any resources that explains how these graphs work? > > Thanks, > Ben Root -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Labeling/distinguishing lots of curves on a single plot
And if you have mutually prime numbers of colors, linestyles, widths, you can automatically generate more distinct lines than I can distinguish... If there's any wxcuse for treating them as a series, I replot when I know how many I have, and space the colors through a colorbar. &C Away from home, checking mail rarely. On Aug 23, 2010, at 2:11 PM, John Salvatier wrote: By the way, I found that the following generator expression made things easy: def styles(): return ( {'c' : color, 'ls' : style, 'lw' : width} for color, style, width in itertools.product(colors, linestyles, linewidths)) then you can do something like for result, style in zip(results, styles()): pylab.plot(result[i], **style) On Mon, Aug 23, 2010 at 1:22 PM, John Salvatier > wrote: Thanks! On Mon, Aug 23, 2010 at 12:38 PM, Aman Thakral wrote: Hi John, Here is a simple way to do it. import matplotlib.pyplot as plt import numpy as np fig = plt.figure() ax = fig.add_subplot(111) colors = ('red','green','blue','yellow','orange') linestyles = ('-','--',':') linewidths = (0.5,2) y = np.random.randn(100,30) x = range(y.shape[0]) i = 0 for c in colors: for ls in linestyles: for lw in linewidths: ax.plot(x,y[:,i],c=c,ls=ls,lw=lw) i+=1 plt.show() On 10-08-23 03:06 PM, John Salvatier wrote: Hello, I have a plot with lots of curves on it (say 30), and I would like to have some way of distinguishing the curves from each other. Just plotting them works well for a few curves because they come out as different colors unless you specify otherwise, but if you do too many you start getting repeats is there a way to have matplotlib also vary the line style that it automatically assigns? Or perhaps someone has another way of distinguishing lots of curves? Best Regards, John --- --- --- - Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users --- --- --- - Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Show() in emacs
My near-newbie suspicion is that you're using more tools than you need and having them interfere with each other. The show() command generally doesn't return control to whatever called it until you've closed the shown window (http://bytes.com/topic/python/answers/635142-matplotlib-basic-question ). if running ipython -pylab from a terminal, successive plot commands display a window with the successively plotted lines in it; if I start the python interpreter from an emacs file in Python-mode, and import pylab, and plot() twice, I also get a single figure window with the successively plotted lines in it -- *until* I switch focus to the figure window, after which calling plot() from the interpreter doesn't do anything to the figure until I close the first figure. (This does seem buggy, or at least suboptimal. I'm using Aquamacs on OS X, don't know if the same interpreter would be called on ubuntu.) Practically speaking, I use the interpreter to check tiny bits of syntax, ipython to noodle around with more complicated syntax or reasoning, and M-! from emacs to execute a whole .py file that I know is mostly right. I hardly ever use show() at all, but rather savefig(), with a file-directory window showing me the results as I go. If that doesn't work for you, the experts probably need a more precise bug report to figure out what would. Chloe Lewis Grad student, ESPM, UC Berkeley On May 25, 2010, at 8:40 PM, Ted Rosenbaum wrote: > Hi, > I am a real newbie at matplotlib, so I apologize if this is an > obvious question. > I am running ipython in emacs and while the first time I use the > show() command in the ipython buffer the graph shows up fine, > subsequent times that I call the command it, the graph does not show > up. I am on ubuntu 10.04 (64) and I built the matplotlib library > from source. > I am trying to get the graphs to show up the subsequent times as > well (sorry for the pun). > Thanks for any help. > > > Ted Rosenbaum > Graduate Student > Department of Economics > Yale University > -- > > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > 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
Re: [Matplotlib-users] get_*gridlines alwys returns the same things?
I got curious and looked for the grid command in matplotlib/axes.py. Looks like an inherited-from-Matlab thing. In the cla (clear axis) function of the Axes class: self._gridOn = rcParams['axes.grid'] #... self.grid(self._gridOn) and grid() passes its argument on to the xaxis.grid and yaxis.grid. I haven't found the code that checks any of those settings to decide whether the gridline objects are to be drawn or not (??) but I think we can rule out Harry Potter. Not magic: adaptation. (Or, if you will, not mystification: legacy code.) &C On May 4, 2010, at 3:27 PM, Nico Schlömer wrote: > This is weird: > > When plotting something very simple, e.g., > >t = arange( 0.0, 2.0, 0.01 ) >s = sin( 2*pi*t ) >plot( t, s, ":" ) > > I thought I can check weather the grid is on or off by > > gca().get_xgridlines() > > -- but this *always* returns > > > > with *always* the same lines > > Line2D((0,0),(0,1)) > Line2D((0,0),(0,1)) > Line2D((0,0),(0,1)) > Line2D((0,0),(0,1)) > Line2D((0,0),(0,1)) > > That's really independent of whether the grid is on or off. > > Is there any explanation for it that does not have to do with Harry > Potter or the Jedi? ;) > > --Nico > > -- > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > 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
Re: [Matplotlib-users] Cmap creation
The example works for me; Python 2.6.4 (recent Enthought install). Can you use your new colormap without registering it? &C On Apr 1, 2010, at 1 Apr, 2:14 PM, Bruce Ford wrote: > I'm running into walls trying to create a custom cmap. > > Running the example custom_cmap.py unchanged, I get : > > AttributeError: 'module' object has no attribute 'register_cmap' > args = ("'module' object has no attribute 'register_cmap'",) > > I've included custom_cmap.py below. It's a major shortcoming that > there is not a suitable anomaly cmap (with white about the middle). > Please consider this for an addition. > > Anyway, what am I missing with this error? Thanks so much! > > Bruce > --- > Bruce W. Ford > Clear Science, Inc. > br...@clearscienceinc.com > http://www.ClearScienceInc.com > Phone/Fax: 904-379-9704 > 8241 Parkridge Circle N. > Jacksonville, FL 32211 > Skype: bruce.w.ford > Google Talk: for...@gmail.com > > -- > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users Chloe Lewis Graduate student, Amundson Lab Ecosystem Sciences 137 Mulford Hall Berkeley, CA 94720-3114 http://nature.berkeley.edu/~chlewis -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Making a data-driven colormap
But this example doesn't solve the problem I was thinking of: it shows lots of colors in the colorbar that aren't used in the plot. &C On Mar 30, 2010, at 6:52 AM, Friedrich Romstedt wrote: > 2010/3/30 Ariel Rokem : >> I ended up with the code below, using Chloe's previously posted >> 'subcolormap' and, in order to make the colorbar nicely attached to >> the main >> imshow plot, I use make_axes_locatable in order to generate the >> colorbar >> axes. I tried it out with a couple of use-cases and it seems to do >> what it >> is supposed to, (with ticks only for the edges of the range of the >> data and >> 0, if that is within that range), but I am not entirely sure. Do >> you think >> it works? > > I think even Chloe would agree that you should avoid the subcolormap() > if you can. I tried to create an as minimalistic as possible but > working self-contained example, please find the code also attached as > .py file: > > from matplotlib import pyplot as plt > import matplotlib as mpl > from mpl_toolkits.axes_grid import make_axes_locatable > import numpy as np > > fig = plt.figure() > ax_im = fig.add_subplot(1, 1, 1) > divider = make_axes_locatable(ax_im) > ax_cb = divider.new_vertical(size = '20%', pad = 0.2, pack_start = > True) > fig.add_axes(ax_cb) > > x = np.linspace(-5, 5, 101) > y = x > Z = np.sin(x*y[:,None]).clip(-1,1-0.1) > > # Leave out if you want: > Z += 2 > > min_val = Z.min() > max_val = Z.max() > bound = max(np.abs(Z.max()), np.abs(Z.min())) > > patch = ax_im.imshow(Z, origin = 'upper', interpolation = 'nearest', >vmin = -bound, vmax = bound) > > cb = fig.colorbar(patch, cax = ax_cb, orientation = 'horizontal', >norm = patch.norm, >boundaries = np.linspace(-bound, bound, 256), >ticks = [min_val, 0, max_val], >format = '%.2f') > > plt.show() > > Friedrich > -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Making a data-driven colormap
Like so, not that it couldn't be improved: import matplotlib.cm as cm import matplotlib.colors as colors import pylab as p def rgb_to_dict(value, cbar): return dict(zip(('red','green','blue','alpha'), cbar(value))) def subcolorbar(xmin, xmax, cbar): '''Returns the part of cbar between xmin, xmax, scaled to 0,1.''' assert xmin < xmax assert xmax <=1 cd = cbar._segmentdata.copy() colornames = ('red','green','blue') rgbmin, rgbmax = rgb_to_dict(xmin, cbar), rgb_to_dict(xmax, cbar) for k in cd: tmp = [x for x in cd[k] if x[0] >= xmin and x[0] <= xmax] if tmp == [] or tmp[0][0] > xmin: tmp = [(xmin, rgbmin[k], rgbmin[k])] + tmp if tmp == [] or tmp[-1][0] < xmax: tmp = tmp + [ (xmax,rgbmax[k], rgbmax[k])] #now scale all this to (0,1) square = zip(*tmp) xbreaks = [(x - xmin)/(xmax-xmin) for x in square[0]] square[0] = xbreaks tmp = zip(*square) cd[k] = tmp return colors.LinearSegmentedColormap('local', cd, N=256) if __name__=="__main__": subset = [.1, .3, .6] scb = subcolorbar(min(subset), max(subset), cm.jet) print 'main segments', cm.jet._segmentdata print 'smaller', scb._segmentdata p.subplot(121) p.scatter([1,2,3],[1,2,3],s=49, c = subset, cmap=scb) p.colorbar() p.subplot(122) p.scatter([2,3,4],[2,3,4],s=49, c =[.001, .5, .99], cmap=cm.jet) p.colorbar() p.show() On Mar 27, 2010, at 11:52 PM, Chloe Lewis wrote: > To zoom in on the relevant section of a colorbar -- I convinced myself > once that I'd need an auxiliary function to define a new cdict that > covers only the current section of the original cdict. (and then > define a new colorbar from the cdict, and maybe do a little norming of > the data). > > _segmentdata will give you the original cdict for whichever colorbar > you're using. > > Not that I got around to actually doing it! But it would be great for > paper readability and passing-around of plots. > > &C > > > > On Mar 27, 2010, at 9:24 PM, Ariel Rokem wrote: > >> Hi Friedrich, >> >> Thanks a lot for your response. I think that you are right - using >> the vmin/vmax args into imshow (as well as into pcolor) does seem to >> do what I want. Great! >> >> The only thing that remains now is to simultaneously stretch the >> colormap in the image itself to this range, while also restricting >> the range of the colorbar which is displayed, to only the part of >> the colormap which actually has values (in the attached .png, I only >> want values between 0 and ~0.33 to appear in the colorbar, not from >> negative -0.33 to +0.33). >> >> Does anyone know how to do that? >> >> Thanks again - >> >> Ariel >> >> On Sat, Mar 27, 2010 at 3:29 PM, Friedrich Romstedt >> >> wrote: >> 2010/3/27 Ariel Rokem : >>> I am trying to make a color-map which will respond to the range of >> values in >>> the data itself. That is - I want to take one of the mpl colormaps >> and use >>> parts of it, depending on the range of the data. >>> >>> In particular, I am interested in using the plt.cm.RdYlBu_r >> colormap. If the >>> data has both negative and positive values, I want 0 to map to the >> central >>> value of this colormap (a pale whitish yellow) and I want negative >> values to >>> be in blue and positive numbers to be in red. Also - I would want >> to use the >>> parts of the colormap that represent how far away the smallest and >> largest >>> values in the data are from 0. So - if my data is in the range >> [x1,x2] I >>> would want to use the part of the colormap in indices >>> 127-127*abs(x1)/(x2-x1) through 127+127*x2/(x2-x1). If the data only >>> includes positive numbers, I would want to only use the blue part >> of the >>> colormap and if there are negative numbers, I would want to only >> use the red >>> part of the colormap (in these cases, I would also want to take >> only a >>> portion of the colormap which represents the size of the interval >> [x1,x2] >>> relative to the interval [0,x1] or [x2,0], as the case may be). >>> >>> I think that this might be useful when comparing matrices >> generated from >>> different data, but with the same computation, such as correlation >> or >>>
Re: [Matplotlib-users] Making a data-driven colormap
To zoom in on the relevant section of a colorbar -- I convinced myself once that I'd need an auxiliary function to define a new cdict that covers only the current section of the original cdict. (and then define a new colorbar from the cdict, and maybe do a little norming of the data). _segmentdata will give you the original cdict for whichever colorbar you're using. Not that I got around to actually doing it! But it would be great for paper readability and passing-around of plots. &C On Mar 27, 2010, at 9:24 PM, Ariel Rokem wrote: > Hi Friedrich, > > Thanks a lot for your response. I think that you are right - using > the vmin/vmax args into imshow (as well as into pcolor) does seem to > do what I want. Great! > > The only thing that remains now is to simultaneously stretch the > colormap in the image itself to this range, while also restricting > the range of the colorbar which is displayed, to only the part of > the colormap which actually has values (in the attached .png, I only > want values between 0 and ~0.33 to appear in the colorbar, not from > negative -0.33 to +0.33). > > Does anyone know how to do that? > > Thanks again - > > Ariel > > On Sat, Mar 27, 2010 at 3:29 PM, Friedrich Romstedt > > wrote: > 2010/3/27 Ariel Rokem : > > I am trying to make a color-map which will respond to the range of > values in > > the data itself. That is - I want to take one of the mpl colormaps > and use > > parts of it, depending on the range of the data. > > > > In particular, I am interested in using the plt.cm.RdYlBu_r > colormap. If the > > data has both negative and positive values, I want 0 to map to the > central > > value of this colormap (a pale whitish yellow) and I want negative > values to > > be in blue and positive numbers to be in red. Also - I would want > to use the > > parts of the colormap that represent how far away the smallest and > largest > > values in the data are from 0. So - if my data is in the range > [x1,x2] I > > would want to use the part of the colormap in indices > > 127-127*abs(x1)/(x2-x1) through 127+127*x2/(x2-x1). If the data only > > includes positive numbers, I would want to only use the blue part > of the > > colormap and if there are negative numbers, I would want to only > use the red > > part of the colormap (in these cases, I would also want to take > only a > > portion of the colormap which represents the size of the interval > [x1,x2] > > relative to the interval [0,x1] or [x2,0], as the case may be). > > > > I think that this might be useful when comparing matrices > generated from > > different data, but with the same computation, such as correlation > or > > coherence (see http://nipy.sourceforge.net/nitime/examples/ > fmri.html to get > > an idea of what I mean). > > I might miss something important, but why not use pcolor() with kwargs > vmin and vmax, > http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.pcolor > > , > e.g.: > > maxval = numpy.abs(C).max() > pcolor(C, vmin = -maxval, vmax = maxval) > > As far as I can judge, this should have the desired effect. > > Friedrich > > > > -- > Ariel Rokem > Helen Wills Neuroscience Institute > University of California, Berkeley > http://argentum.ucbso.berkeley.edu/ariel > < > colorbar > .png > > > -- > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ask.scipy.org is online
Oh, nice. I've been flagging particularly useful-looking answers on the matplotlib mailing list for a while; I have four or five hundred marked. I don't want to do all the cleanup to make them an inoculant for a new site, but perhaps they would be useful for people to do a few each or throw in their own favorites? modulo concerns over attribution, etc Chloe On Mar 18, 2010, at 18 Mar, 10:20 AM, Gökhan Sever wrote: Hello, Please tolerate my impatience for being the first announcing the new discussion platform :) and my cross-posting over the lists. The new site is beating at ask.scipy.org . David Warde-Farley is moving the questions from the old-site at advice.mechanicalkern.com (announced at SciPy09 by Robert Kern) We welcome you to join the discussions there. I have kicked-off the new questions chain by http://ask.scipy.org/en/topic/11-what-is-your-favorite-numpy-feature (Also cross-posted at http://stackoverflow.com/questions/2471872/what-is-your-favorite-numpy-feature to pull more attention to ask.scipy) Please share your questions and comments, and have fun with your discussions. -- Gökhan -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users Chloe Lewis Graduate student, Amundson Lab Ecosystem Sciences 137 Mulford Hall Berkeley, CA 94720-3114 http://nature.berkeley.edu/~chlewis -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plot a lambda function?
...although >>plot(map(lambda x:x**2, range(5,15))) probably doesn't do exactly what you want; is the idea that >>plot(range(5,15),lambda x:x**2) #DOESN'T WORK should automatically work like >>plot(range(5,15), map(lambda x:x**2, range(5,15))) by recognizing that the second argument is a function rather than a list? &C On Mar 10, 2010, at 10:47 AM, Chloe Lewis wrote: > You'd always have to specify the domain, so > > plot(map(lambda x:x**2, range(1,10))) > > shouldn't be much longer than the minimal command. > > &C > > > On Mar 10, 2010, at 10:12 AM, max ulidtko wrote: > >> Hi. >> >> Is it possible to plot arbitrary lambda function with matplotlib? >> Say, if i have f = lambda x: x*sin(x), can i just plot it without >> building argument-value arrays? It would be a very convenient and >> useful feature. >> >> >> -- >> Sincerely, >> max ulidtko >> -- >> Download Intel® Parallel Studio Eval >> Try the new software tools for yourself. Speed compiling, find bugs >> proactively, and fine-tune applications for parallel performance. >> See why Intel Parallel Studio got high marks during beta. >> http://p.sf.net/sfu/intel-sw-dev___ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > -- > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plot a lambda function?
You'd always have to specify the domain, so plot(map(lambda x:x**2, range(1,10))) shouldn't be much longer than the minimal command. &C On Mar 10, 2010, at 10:12 AM, max ulidtko wrote: > Hi. > > Is it possible to plot arbitrary lambda function with matplotlib? > Say, if i have f = lambda x: x*sin(x), can i just plot it without > building argument-value arrays? It would be a very convenient and > useful feature. > > > -- > Sincerely, > max ulidtko > -- > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] grey scale line plots
> [...] I deduce from your approach that there is nothing > built in. I am surprised [...] When you mentioned it, so was I. From axes.py: def set_default_color_cycle(clist): """ Change the default cycle of colors that will be used by the plot command. This must be called before creating the :class:`Axes` to which it will apply; it will apply to all future axes. *clist* is a sequence of mpl color specifiers """ _process_plot_var_args.defaultColors = clist[:] rcParams['lines.color'] = clist[0] That will tidy things up a bit. Not only do I change to B&W for plots I expect to print, I try to switch fonts and DPI and so forth as a group for print vs. screen vs. projector. I don't have that all ironed out yet, though. &C -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] grey scale line plots
Here's a skeleton, for a series of lines that get darker and more solid (from past to present, as I use it): from itertools import cycle grey_linestyles = cycle(map(lambda tu: dict(zip(('color','dashes'),tu)),(('0.5',(4,1,1,1)),('0.4',(2,1)), ('0.3',(5,1,2,1)),('0.2',(4,1)),('0.1',(6,1)),('0.0',(10,1)),('0.0', (20,1) class IsotoProfileFigure(Figure): def __init__(self, *args, **kwargs): self.linestyles = grey_linestyles def plot(self, gases, label='_nolegend'): style = self.linestyles.next() #TODO: allow for usual style modifiers passed in self.isoaxis.plot(deltas,self.verts,label=label, **style) On Mar 9, 2010, at 9 Mar, 1:52 PM, Alan G Isaac wrote: > I need a figure containing color line plots to > be changed to grayscale, cycling through line > styles instead of colors. How? > > Thanks, > Alan Isaac > > PSI suppose I searched the web ineffectively on this, > but I did try. > > > -- > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users Chloe Lewis Graduate student, Amundson Lab Ecosystem Sciences 137 Mulford Hall Berkeley, CA 94720-3114 http://nature.berkeley.edu/~chlewis -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] half-filled markers, two-colors
wrote: > ...maybe dividing the markers up into 2, 3, or 4 sections would be > useful too. > ... There's a gallery example doing that in general, making pie-charts out of the markers: http://matplotlib.sourceforge.net/examples/api/scatter_piecharts.html although I think my demo of it shows off its data-representation better: # Piechart markers from matplotlib gallery, thanks to Manuel Metz for the original example # CPHLewis, 2010. import math import numpy as np import matplotlib.pyplot as plt def payoff(x,y): return x*y*400 def outcome_xwins(x,y): return x/(x+y) def outcome_ywins(x,y): return y/(x+y) x_cases = [ .25, .5, .75] y_cases = [ .33, .5, .66] outcomes = [('x wins', outcome_xwins, 'blue'), ('y wins', outcome_ywins, 'green')] #the name, calculation, and plotting color for categories of outcome fig = plt.figure() ax = fig.add_subplot(111) ax.set_title('Small multiples: pie charts calculated based on (x,y)') legend_once = True #At each point in the plot we calculate everything about the outcomes. for x in x_cases: for y in y_cases: size = payoff(x,y) start_at = 0 for result in outcomes: result_share = result[1](x,y) xpt = [0] + np.cos(np.linspace(2*math.pi*start_at, 2*math.pi*(result_share+start_at), 10)).tolist() ypt = [0] + np.sin(np.linspace(2*math.pi*start_at, 2*math.pi*(result_share+start_at), 10)).tolist() xypt = zip(xpt, ypt) ax.scatter([x],[y], marker = (xypt, 0), s = size, facecolor = result[2], label=result[0]) start_at = start_at + result_share if legend_once: ax.legend() #don't know why this isn't picking up the labels. legend_once = False plt.show() -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Retake control of colorbar?
How about returning the colorbar limits from pcl(), and using the larger extent of those limits and the ones from the scatter data when you call the colorbar in sct()? (ScalarMappables have get_clim(), set_clim().) Or, more generally, record the data limits and have both functions check them, in case someday you want to call pcl() after sct(). In general, I like the figure style for an experiment or case to be a class, with plotting functions like the ones you've already written but data members that either pretty up the functions, or are useful for other reports ('Variability and drift between runs'...), etc. &C On Feb 10, 2010, at 10 Feb, 9:41 AM, Bror Jonsson wrote: > > Dear all, > > This is probably a silly question based on my bias from matlab, but > I have tried for two days without luck. I need to make pcolor plots > in several figures, and the go back and add a scatter on each. This > procedure is necessary due to how I read the data. My problem is > that I can't figure out how update the colorbar in the end. > > An example is as follows: > > #= > import random > > import pylab as pl > import numpy as np > > from numpy.random import rand > > def pcl(fig,val): > pl.figure(fig) > pl.clf() > pl.pcolor(val) > pl.colorbar() > > def sct(fig,xvec,yvec,cvec): > pl.figure(fig) > pl.scatter(xvec,yvec,40,cvec) > pl.xlim(0,10) > pl.ylim(0,10) > pl.colorbar(orientation='horizontal') > > pcl(1, rand(20,20)*10) > pcl(2, rand(20,20)*10) > pcl(3, rand(20,20)*10) > > sct(1,rand(10)*10,rand(10)*10,rand(10)*40) > sct(2,rand(10)*10,rand(10)*10,rand(10)*40) > sct(3,rand(10)*10,rand(10)*10,rand(10)*40) > #= > > I would like the pcolor image and the colorbar to have the same clim > extents as the scatter in the end. Is this in any way possible? > > Many thanks for any help! > > :-)Bror > > > > -- > SOLARIS 10 is the OS for Data Centers - provides features such as > DTrace, > Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW > http://p.sf.net/sfu/solaris-dev2dev > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users Chloe Lewis Graduate student, Amundson Lab Ecosystem Sciences 137 Mulford Hall Berkeley, CA 94720-3114 http://nature.berkeley.edu/~chlewis -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Circular colormaps
... and for dessert, is there a circular colormap that would work for the colorblind? My department is practicing presenting-science-for-the-general-public, and the problems 'heat maps' have for the colorblind keep coming up. handy: http://konigi.com/tools/submissions/color-deficit-simulators &C On Nov 8, 2009, at 3:34 AM, Gary Ruben wrote: > Hi Ariel, > > You might find the attached function helpful here. Try creating a > new colormap using the example in the docstring (you could also try > setting high=0.8) - basically this will let you turn down the > saturation which will hopefully solve your problem. You may also > find the plot option useful to see what the individual colour > channels are doing if you decide to make a new colormap of your own > - you just need to ensure that the r, g, and b values match at both > ends. > > Gary > > > Ariel Rokem wrote: >> Hi everyone, >> I am interested in using a circular colormap, in order to represent >> a phase variable, but I don't like 'hsv' (which is circular). In >> particular, I find that it induces perceptual distortion, where >> values in the green/yellow part of the colormap all look the same. >> Are there any circular colormaps except for 'hsv'? If not - how >> would you go about constructing a new circular colormap? Thanks, >> Ariel >> -- >> Ariel Rokem >> Helen Wills Neuroscience Institute >> University of California, Berkeley >> http://argentum.ucbso.berkeley.edu/ariel > import numpy as np > import matplotlib.pyplot as plt > import matplotlib.colors as colors > import matplotlib._cm as _cm > > > def rescale_cmap(cmap_name, low=0.0, high=1.0, plot=False): >''' >Example 1: >my_hsv = rescale_cmap('hsv', low = 0.3) # equivalent scaling > to cplot_like(blah, l_bias=0.33, int_exponent=0.0) >Example 2: >my_hsv = rescale_cmap(cm.hsv, low = 0.3) >''' >if type(cmap_name) is str: >cmap = eval('_cm._%s_data' % cmap_name) >else: >cmap = eval('_cm._%s_data' % cmap_name.name) >LUTSIZE = plt.rcParams['image.lut'] >r = np.array(cmap['red']) >g = np.array(cmap['green']) >b = np.array(cmap['blue']) >range = high - low >r[:,1:] = r[:,1:]*range+low >g[:,1:] = g[:,1:]*range+low >b[:,1:] = b[:,1:]*range+low >_my_data = {'red': tuple(map(tuple,r)), >'green': tuple(map(tuple,g)), >'blue': tuple(map(tuple,b)) > } >my_cmap = colors.LinearSegmentedColormap('my_hsv', _my_data, > LUTSIZE) > >if plot: >plt.figure() >plt.plot(r[:,0], r[:,1], 'r', g[:,0], g[:,1], 'g', b[:,0], > b[:,1], 'b', lw=3) >plt.axis(ymin=-0.2, ymax=1.2) > >return my_cmap > -- > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 > 30-Day > trial. Simplify your report design, integration and deployment - and > focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. > http://p.sf.net/sfu/bobj-july___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] variable line color in plots
I use a scatterplot with enough points to overlap into a line. Works best with alpha=0.5 or thereabouts; I generally overplot with a dashed B&W line to make the legend understandable. Probability that there is a more elegant way: high. &C On Oct 14, 2009, at 9:23 AM, Devin Silvia wrote: > > Does anyone know if its possible to vary the line color according to > some > pre-defined array in a standard line plot (either linear or > loglog)? As an > example, I would like to color the line so that it indicates > progression of > time. > -- > View this message in context: > http://www.nabble.com/variable-line-color-in-plots-tp25894279p25894279.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > -- > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart > your > developing skills, take BlackBerry mobile applications to market and > stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Setting size of subplot
You will probably want to add axes explicitly (not with subplot), e.g. fig.add_axes([.1,.1,.71,.8]) specifies the coordinates of one corner and the width and height (in proportions of the figure size). When doing this explicitly, you will probably need to do some extra adjustments to fit the axis labels and so forth. &C On Oct 5, 2009, at 5:59 PM, Donovan Parks wrote: > Hello, > > I am new to matplotlib and am having trouble understanding how to set > the size of a subplot when a figure contains multiple subplots. In > particular, I have been playing around with the scatter_hist.py demo > at http://matplotlib.sourceforge.net/examples/axes_grid/scatter_hist.html > . > A simplified version of this code is given below: > > * > > import numpy as np > import matplotlib.pyplot as plt > from mpl_toolkits.axes_grid import make_axes_locatable > > fig = plt.figure(1, figsize=(4,4)) > > axScatter = plt.subplot(111) > divider = make_axes_locatable(axScatter) > axHisty = divider.new_horizontal(1.2, pad=0.5, sharey=axScatter) > fig.add_axes(axHisty) > > x = np.random.randn(1000) > y = np.random.randn(1000) > axScatter.scatter(x, y) > axHisty.hist(x, orientation='horizontal') > > plt.draw() > plt.show() > > * > > I'd like to have direct control over the size of the scatter plot in > this figure. As it stands, I can 'sort of' control its size by > changing the figsize property of the figure. I say 'sort of' since the > size of any labels also come into play here. Is it possible to > directly make the scatter plot a certain size (say, 3 x 2 inches), set > the figure size independently (say, 5 x 4 inches), and have the > histogram size be set based on the scatter plot height and width set > in divider.new_horizontal (in this case to 3 x 1.2 inches)? > > I realize that in this example, it probably seems silly to not just > change figsize, but I am working with a more complicated plot in > reality where I'd like precise control over the size of the initial > subplot since the aspect ratio is important to me. I can then adjust > the figsize to make sure all the labels fit in nicely. > > Thanks for any and all help. > > Cheers, > Donovan > > -- > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart > your > developing skills, take BlackBerry mobile applications to market and > stay > ahead of the curve. Join us from November 9-12, 2009. Register > now! > http://p.sf.net/sfu/devconf > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Three-Phase-Diagrams with matplotlib
If your percents always sum to 100, you can use a subclass of Figure I made up for soil science; pictures at http://nature.berkeley.edu/~chlewis/Projects/Entries/2009/6/25_A_function_to_plot_information_on_the_soil_texture_triangle.html (non-soil example at end) and code at http://nature.berkeley.edu/~chlewis/Sourcecode.html &C On Aug 24, 2009, at 12:23 PM, M. Hecht wrote: > > Hello, > > does anyone know whether it is possible to draw three-phase-diagrams > with > matplotlib? > > A three-phase-diagram is a triangular diagram applied in chemistry > e.g. for > slags where > one has three main components of a chemical substance at the corners > and > points or lines > within the triangle marking different compositions of the substances > in > percent, e.g. > in metallurgy 20% Al2O3, 45% CaO and 35% SiO2. > > -- > View this message in context: > http://www.nabble.com/Three-Phase-Diagrams-with-matplotlib-tp25122001p25122001.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > -- > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 > 30-Day > trial. Simplify your report design, integration and deployment - and > focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users Chloe Lewis Graduate student, Amundson Lab Division of Ecosystem Sciences, ESPM University of California, Berkeley 137 Mulford Hall - #3114 Berkeley, CA 94720-3114 chle...@nature.berkeley.edu -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Newbie problem using csv2rec
hought it > would be. I expected thousands of records and I have 10. I expected > times and dates, ints and strings. And all I have are masked values. > > In [143]: r > Out[143]: > masked_records( >date : [-- -- -- -- -- -- -- -- -- --] >time : [-- -- -- -- -- -- -- -- -- --] > program : [-- -- -- -- -- -- -- -- -- --] > level : [-- -- -- -- -- -- -- -- -- --] >error_id : [-- -- -- -- -- -- -- -- -- --] > thread : [-- -- -- -- -- -- -- -- -- --] > na : [-- -- -- -- -- -- -- -- -- --] > machine : [-- -- -- -- -- -- -- -- -- --] > request : [-- -- -- -- -- -- -- -- -- --] > detail : [-- -- -- -- -- -- -- -- -- --] >fill_value : ('?', '?', '?', '?', '?', '?', '?', '?', '?', '?') > ) > > > So I look at the mask. I see no clues here. > > In [144]: r.mask > Out[144]: > array([(True, True, True, True, True, True, True, True, True, True), > (True, True, True, True, True, True, True, True, True, True), > (True, True, True, True, True, True, True, True, True, True), > (True, True, True, True, True, True, True, True, True, True), > (True, True, True, True, True, True, True, True, True, True), > (True, True, True, True, True, True, True, True, True, True), > (True, True, True, True, True, True, True, True, True, True), > (True, True, True, True, True, True, True, True, True, True), > (True, True, True, True, True, True, True, True, True, True), > (True, True, True, True, True, True, True, True, True, True)], > dtype=[('date', '|b1'), ('time', '|b1'), ('program', '|b1'), > ('level', '|b1'), ('error_id', '|b1'), ('thread', '|b1'), ('na', > '|b1'), ('machine', '|b1'), > ('request', '|b1'), ('detail', '|b1')]) > > > Well, maybe if I change the mask I can see what is being hidden. > > In [145]: r.mask[0] > Out[145]: (True, True, True, True, True, True, True, True, True, True) > > In [146]: r.mask[0]=(False,)*10 > > In [147]: r > Out[147]: > masked_records( >date : [2009-08-17 -- -- -- -- -- -- -- -- --] >time : [2009-08-17 -- -- -- -- -- -- -- -- --] > program : [2009-08-17 -- -- -- -- -- -- -- -- --] > level : [2009-08-17 -- -- -- -- -- -- -- -- --] >error_id : [2009-08-17 -- -- -- -- -- -- -- -- --] > thread : [2009-08-17 -- -- -- -- -- -- -- -- --] > na : [2009-08-17 -- -- -- -- -- -- -- -- --] > machine : [2009-08-17 -- -- -- -- -- -- -- -- --] > request : [2009-08-17 -- -- -- -- -- -- -- -- --] > detail : [2009-08-17 -- -- -- -- -- -- -- -- --] >fill_value : ('?', '?', '?', '?', '?', '?', '?', '?', '?', '?') > ) > > > So I think I see what is going on. Rather than taking each line of > the input file as a record it is taking each column as a record. > Since I said there are ten values per record it stopped after ten rows > since that is all the columns it had to fill in. > > Now you know my problem. > > How do I get csv2rec to read my file so I can start getting nice > histograms of counts per day? > > A further question is why am I getting masked records at all and how > do I control this? I don't see anything in the numpy or matplotlib > user guides that answer this. I did find a helpful document on the > web (http://www.bom.gov.au/bmrc/climdyn/staff/lih/pubs/docs/masks.pdf) > that explained what masks are > and why and how they can be used. I don't need them and would like to > make sure that nothing is masked. > > Thanks in advance for helping a newbie over the hump. > > Phil Robare > > -- > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 > 30-Day > trial. Simplify your report design, integration and deployment - and > focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users Chloe Lewis Graduate student, Amundson Lab Division of Ecosystem Sciences, ESPM University of California, Berkeley 137 Mulford Hall - #3114 Berkeley, CA 94720-3114 chle...@nature.berkeley.edu -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Color Map
(almost?) all the colormaps exist in reversed forms, eg, cm.hot_r On Jul 20, 2009, at 10:47 AM, Ritayan Mitra wrote: > Hello > I am trying to use imshow as below > > im = imshow(Z, interpolation='spline16', origin='lower', cmap=cm.hot, > extent=(-1.,1.,-1.,1.)) > > Trouble is I want to reverse the color gradient or use some > colorscheme > which has lighter color at the bottom and darker higher up. What is > the > easiest solution to this problem? Thanks a bunch. > > Rit > > > -- > Enter the BlackBerry Developer Challenge > This is your chance to win up to $100,000 in prizes! For a limited > time, > vendors submitting new applications to BlackBerry App World(TM) will > have > the opportunity to enter the BlackBerry Developer Challenge. See > full prize > details at: http://p.sf.net/sfu/Challenge > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users Chloe Lewis Graduate student, Amundson Lab Division of Ecosystem Sciences, ESPM University of California, Berkeley 137 Mulford Hall - #3114 Berkeley, CA 94720-3114 chle...@nature.berkeley.edu -- Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] setting axis limits
Experimenting in ipython (run ipython --pylab) is excellent for this; not only do you see results promptly, but help(pylab) lists, for instance, the functions xlim and ylim, with which you can get and set any of the four axis limits. &C On Jul 15, 2009, at 3:54 PM, Dr. Phillip M. Feldman wrote: > > One can set axis limits via a command like the following: > > pyplot.axis([0 10 0 1]) > > But, there are situations where I'd like to set limits only for the > y-axis, > leaving the x-axis alone, or vice versa, or set a lower limit for > the y-axis > but leave the upper limit alone. Is there a clean way of doing > this? (I > have not been able to find anything relevant in the Matplotlib Users > Guide). > -- > View this message in context: > http://www.nabble.com/setting-axis-limits-tp24507383p24507383.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > -- > Enter the BlackBerry Developer Challenge > This is your chance to win up to $100,000 in prizes! For a limited > time, > vendors submitting new applications to BlackBerry App World(TM) will > have > the opportunity to enter the BlackBerry Developer Challenge. See > full prize > details at: http://p.sf.net/sfu/Challenge > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users Chloe Lewis Graduate student, Amundson Lab Division of Ecosystem Sciences, ESPM University of California, Berkeley 137 Mulford Hall - #3114 Berkeley, CA 94720-3114 chle...@nature.berkeley.edu -- Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plotting disjoint horizontal lines
If your collection of points is a numpy array, you can use the column of y-coordinates as the first argument to the plotting function hlines. E.g, inside ipython --pylab: ptn = array(([1,1],[3,1],[2,4],[4,4])) hlines(ptn[:,1], -1, 1) But at that point the horizontal lines are on the edges of the axis, not visible. This forces them to show: plot([-1, 0, 1],[0.5, 2.5, 4.5]) but perhaps you only want the hlines. What I usually do in a script or function is name all my axes and twiddle their limits in an aesthetic way, but in ipython the following isn't redrawing the plot, for me: a = gca() curlims = a.get_ylim() a.set_ylim([curlims[0] - 0.1, curlims[1] + 0.1]) half-finished, but I hope it helps, &C On Jul 13, 2009, at 13 Jul, 11:56 AM, Afi Welbeck wrote: Hi, I'm a newbie, and I'm trying to plot horizontal lines with the following points: [1,1], [3,1], [2,4] and [4,4]. Also, is there a way of putting them together in lists, (say the pair of points that plot one horizontal line ) for easy plotting? Could anyone please help me with the code? Thanks. Regards, Harriet A. Welbeck -- Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Chloe Lewis Graduate student, Amundson Lab Division of Ecosystem Sciences, ESPM University of California, Berkeley 137 Mulford Hall - #3114 Berkeley, CA 94720-3114 chle...@nature.berkeley.edu -- Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Transforms examples
Any current transforms examples? The transforms docs suggest looking in /units for transforms examples; the current matplotlib examples has /units without transforms. (I want something a bit more detailed than the offset.) If the transforms are currently too much in flux, I'll do something one-off, but I'd like to do it the Right Way if I can. &C - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Figure titles and subplot titles
and a quick sample (not suptitle, but using subplots_adjust): import pylab as p p.figtext(0.5,0.9,'Big Old Title', ha='center') p.subplots_adjust(top=0.8) p.subplot(1,2,1) p.title('Lefthand') p.plot([4,3,2,1]) p.subplot(1,2,2) p.title('Righthand') p.plot([3,3,1,3]) On Jun 21, 2007, at 21 Jun,2:14 PM, Philip Austin wrote: > [EMAIL PROTECTED] writes: >> I didn't see this in the examples. Can I have a figure title and >> titles >> for subplots too? Can someone post a quick sample? Thanks. > > here's a short answer: > http://thread.gmane.org/gmane.comp.python.matplotlib.devel/1071/ > focus=1117 > > -- Phil > > > -- > --- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] standardizing x-axes in hist
Once the axes are the same, can one get the actual bars to align? hist () arranges them to look well in their original ranges, so they don't line up together, AFAICT: #plotting barcharts w/different ranges on same axis import pylab a = [1]*2 + [2]*3 + [3]*4 b = [3]*1 + [4]*2 + [5]*3 allim = (min(min(a),min(b)), max(max(a),max(b))) top = pylab.subplot(211) vala, bina, patcha = pylab.hist(a) #top.set_xlim(allim) #doesn't work here bot = pylab.subplot(212, sharex=top) valb, binb, patchb = pylab.hist(b) top.set_xlim(allim) pylab.show() - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] can matplotlib make a plot like this?
I was thinking of something like this - it isn't pretty, but it does get all the data on the page. import pylab # Annoying-to-plot data data=[1]*100 + [2]*3 + [3]*2+ [4]*3 + [5] # Make a histogram out of the data in x and prepare a bar plot. top = pylab.subplot(211) vals, bins, patchs = pylab.hist(data) # but only show the top fraction of the graph in the upper plot top.set_ylim(max(vals)-2, max(vals)+2) bot = pylab.subplot(212) vals, bins, patchs=pylab.hist(data) bot.set_ylim(0,4) pylab.show() - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] can matplotlib make a plot like this?
I don't know how to make the "//" symbol in the y-axis, but if you have two plots that share the same x-axis, you can represent this kind of data. The "Working with multiple figure and axes" section of the tutorial http://matplotlib.sourceforge.net/tutorial.html is almost right; if you turn off the display of the x-axis in the upper plot, it will be even better. &C On Oct 19, 2006, at 3:05 PM, CL wrote: > Hi, group, > I am wondering if matplotlib can make a plot look like > the attached one. Basically, the y-axis was collapsed to show both > one extreme value and the rest of smaller values. > > Thanks. > > Chunlei > > > > > -- > --- > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make your > job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel? > cmd=lnk&kid=120709&bid=263057&dat=121642__ > _ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users