[Matplotlib-users] Custom toolbar.Is it possible?
Hello, matplotlib have nice and helpfull feature - navigation toolbar. But in some cases some default buttons are not needed. Is it possible to customize NavigationToolbar (e.g. disable or hide some buttons)? I'm use matplotlib with PyQt 4.4.3 and Python 2.5.4 under Windows XP. Thanks, Alexander Bruy -- реклама --- Поторопись зарегистрировать самый короткий почтовый адрес @i.ua http://mail.i.ua/reg - и получи 1Gb для хранения писем -- 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] Equal area projection
Angus McMorland wrote: > Hi all, > > I've recently implemented a simple equal area (Lambert) projection in > mpl, using two polar Axes (to draw each hemisphere), and this > currently works fine to draw lines and points, since I'm transforming > the points in my own code, from 3d-polar to 2d-projected-polar > co-ordinates, and then plotting those. > > Now I have a need to also be able to draw coloured intensity maps on > the Axes using the same transform, and I'm wondering what the best way > to go about this would be. When I started the first implementation, I > looked at basemap and its transforms, but they didn't seem to do what > I wanted any more easily than just implementing it myself. Angus: I'm curious about how you came to this conclusion. It seems like this should be trivial in Basemap, in fact it's exactly what I designed it for. If you send me a sample of your data, I can give you a simple script to plot it with Basemap. -Jeff > I'm also > vaguely aware of some transformation capabilities (that are relatively > new?) in mpl itself, but I'm not sure whether they're useful to me for > polar co-ordinate systems and plot contents, rather than plot > decorations. Ideally, the transform would apply to the interpolation > too, but I think it would be sufficient to linearly interpolate > between the points: I can simply provide them at high enough density > to minimize the discrepancy. > > Any suggestions on the best way to do this would be gratefully received. > > Thanks, > > Angus. > -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX: (303)497-6449 NOAA/OAR/PSD R/PSD1Email : jeffrey.s.whita...@noaa.gov 325 BroadwayOffice : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg -- 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
[Matplotlib-users] Equal area projection
Hi all, I've recently implemented a simple equal area (Lambert) projection in mpl, using two polar Axes (to draw each hemisphere), and this currently works fine to draw lines and points, since I'm transforming the points in my own code, from 3d-polar to 2d-projected-polar co-ordinates, and then plotting those. Now I have a need to also be able to draw coloured intensity maps on the Axes using the same transform, and I'm wondering what the best way to go about this would be. When I started the first implementation, I looked at basemap and its transforms, but they didn't seem to do what I wanted any more easily than just implementing it myself. I'm also vaguely aware of some transformation capabilities (that are relatively new?) in mpl itself, but I'm not sure whether they're useful to me for polar co-ordinate systems and plot contents, rather than plot decorations. Ideally, the transform would apply to the interpolation too, but I think it would be sufficient to linearly interpolate between the points: I can simply provide them at high enough density to minimize the discrepancy. Any suggestions on the best way to do this would be gratefully received. Thanks, Angus. -- AJC McMorland Post-doctoral research fellow Neurobiology, University of Pittsburgh -- 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] Design questions
On Mon, Jul 27, 2009 at 4:06 PM, Gewton Jhames wrote: > How to "trim the canvas" of the image generated? It's transparent, but still > have a "padding", if it would be cropped, I can safe almost 200px!. I have > attached a file to this email to show it, the background of the graph was > set to red only to you see the padding. As John suggested, you can adjust the subplot params. This adjusts the area occupied by the axes, while the figure size (canvas size) is fixed. The subplot params can be automatically adjusted. http://matplotlib.sourceforge.net/faq/howto_faq.html?highlight=automatic%20adjust#automatically-make-room-for-tick-labels On the other hand, there is some crude support for trimming, i.e., reducing the figure size while the axes area fixed. savefig("file.png", bbox_inches="tight") Note that the figure size of the saved output is only affected. This does not change the figure displayed on the screen. Regards, -JJ -- 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] Design questions
On Mon, Jul 27, 2009 at 3:06 PM, Gewton Jhames wrote: > Thanks everyone. Everything works perfectly. > Only a few things left: > > How to "trim the canvas" of the image generated? It's transparent, but still > have a "padding", if it would be cropped, I can safe almost 200px!. I have > attached a file to this email to show it, the background of the graph was > set to red only to you see the padding. use fig.subplots_adjust(left=0.05, bottom=0.05, top=0.05, right=0.05) etc to trim the excess space > In the file attached to this email, the graph have a space after the > position 23:00, I wish to remove it. Several ways to do it: one is: ax.autoscale_view(tight=True, scaley=False) Use -- 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] Design questions
On Mon, Jul 27, 2009 at 10:55 AM, Tony S Yu wrote: > Below is some code to do 1, 2, and 4. > The 3rd issue is a bit more difficult. One approach is to use > Jae-Joon's AxesGrid toolkit; you > may need to be using the latest development version of matplotlib to use the toolkit. > BTW, does anyone know why it's ``ax.set_axis_bgcolor`` instead of > ``ax.set_facecolor``? very old legacy where the axis background color "bgcolor" predated the existance of an axes patch with the unified kwargs. If people want to deprecate it in favor of ax.patch.set_facecolor(color) I don't object. JDH -- 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] Radar / Spider Chars
Tony, I know this is a year later but your code was hugely helpful to me last week, so thank you. I needed to make a few modifications to get exactly what I needed, so I thought I'd add to the post for posterity... First, here is the graphic that the sample code generates (>> execfile('radarPlotExample.py'): http://www.nabble.com/file/p24688050/profileComparisonPub.png profileComparisonPub.png Suffice it to say, I think this looks way better than what you get out of R or MATLAB (e.g. http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=123). Here is the code. I have tried to add comments in places that differ from Tony's code. I am a relatively new Python and matplotlib convert, so please feel free to comment on better ways to do this. But, like Tony said, hopefully this will help someone. Josh --- radarPlotExample.py --- from matplotlib.projections.polar import PolarAxes from matplotlib.projections import register_projection from pylab import * def radar_factory(num_vars, frame='polygon'): """Create a radar chart with `num_vars` axes. """ # calculate evenly-spaced axis angles theta = 2*pi * linspace(0, 1-1/float(num_vars), num_vars) #print theta #print # rotate theta such that the first axis is at the top theta += pi/2 def draw_poly_frame(self, x0, y0, r): # TODO: should use transforms to convert (x, y) to (r, theta) verts = [(r*cos(t) + x0, r*sin(t) + y0) for t in theta] return Polygon(verts, closed=True) def draw_circle_frame(self, x0, y0, r): return Circle((x0, y0), r) frame_dict = {'polygon': draw_poly_frame, 'circle': draw_circle_frame} if frame not in frame_dict: raise ValueError, 'unknown value for `frame`: %s' % frame class RadarAxes(PolarAxes): """Class for creating a radar chart (a.k.a. a spider or star chart) http://en.wikipedia.org/wiki/Radar_chart """ name = 'radar' # use 1 line segment to connect specified points RESOLUTION = 1 # define draw_frame method draw_frame = frame_dict[frame] def fill(self, *args, **kwargs): """Override fill so that line is closed by default""" closed = kwargs.pop('closed', True) return super(RadarAxes, self).fill(closed=closed, *args, **kwargs) def plot(self, *args, **kwargs): """Override plot so that line is closed by default""" lines = super(RadarAxes, self).plot(*args, **kwargs) for line in lines: self._close_line(line) def _close_line(self, line): x, y = line.get_data() # FIXME: markers at x[0], y[0] get doubled-up if x[0] != x[-1]: x = concatenate((x, [x[0]])) y = concatenate((y, [y[0]])) line.set_data(x, y) def set_varlabels(self, labels, rvals, rlabels): self.set_thetagrids(theta * 180/pi, labels) #Josh says: The rvals and rlabels parameters were added to support #the call to the set_rgrid method so you can control the position #and labelling of the circular grid lines. Make the radii labels #smaller than the default size... self.set_rgrids(rvals, labels=rlabels, size='small') def get_axes_patch(self): x0, y0 = (0.5, 0.5) r = 0.5 return self.draw_frame(x0, y0, r) register_projection(RadarAxes) return theta if __name__ == '__main__': #The following data is from the Denver Aerosol Sources and Health study. #See doi:10.1016/j.atmosenv.2008.12.017 # #The data are pollution source profile estimates for five modeled pollution #sources (e.g., cars, wood-burning, etc) that emit 7-9 chemical species. #The radar charts are experimented with here to see if we can nicely #visualize how the modeled source profiles change across four scenarios: # 1) No gas-phase species present, just seven particulate counts on # Sulfate # Nitrate # Elemental Carbon (EC) # Organic Carbon fraction 1 (OC) # Organic Carbon fraction 2 (OC2) # Organic Carbon fraction 3 (OC3) # Pyrolized Organic Carbon (OP) # 2)Inclusion of gas-phase specie carbon monoxide (CO) # 3)Inclusion of gas-phase specie ozone (O3). # 4)Inclusion of both gas-phase speciesis present... N = 9 theta = radar_factory(N) f1_base = [0.88, 0.01, 0.03, 0.03, 0.00, 0.06, 0.01, 0.00, 0.00] f1_CO = [0.88, 0.02, 0.02, 0.02, 0.00, 0.05, 0.00, 0.05, 0.00] f1_O3 = [0.89, 0.
Re: [Matplotlib-users] Design questions
That's right Gökhan, I should have thought on it before ask. Thanks. Only the first one remains... this one I could not find a way. I know there is one class called FigureCanvasAgg, but I didn't find anything on it. On Mon, Jul 27, 2009 at 5:16 PM, Gökhan SEVER wrote: > For the 2nd one; > > To re-position the figure content you might use axis(xmin= , xmax= ) > > > On Mon, Jul 27, 2009 at 3:06 PM, Gewton Jhames wrote: > >> Thanks everyone. Everything works perfectly. >> Only a few things left: >> >>1. How to "trim the canvas" of the image generated? It's transparent, >>but still have a "padding", if it would be cropped, I can safe almost >>200px!. I have attached a file to this email to show it, the background of >>the graph was set to red only to you see the padding. >>2. In the file attached to this email, the graph have a space after >>the position 23:00, I wish to remove it. >> >> >> On Mon, Jul 27, 2009 at 1:37 PM, Jae-Joon Lee wrote: >> >>> On Mon, Jul 27, 2009 at 11:55 AM, Tony S Yu wrote: >>> > The 3rd issue is a bit more difficult. One approach is to use >>> > Jae-Joon's AxesGrid toolkit; you >>> > >>> may need to be using the latest development version of matplotlib to use >>> the toolkit. >>> >>> I think it would be easier to use the recently added spine support, >>> because using the AxesGrid toolkit has some side-effects. >>> >>> >>> http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html >>> >>> Regards, >>> >>> -JJ >>> >> >> >> >> -- >> >> ___ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> > > > -- > Gökhan > -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Design questions
For the 2nd one; To re-position the figure content you might use axis(xmin= , xmax= ) On Mon, Jul 27, 2009 at 3:06 PM, Gewton Jhames wrote: > Thanks everyone. Everything works perfectly. > Only a few things left: > >1. How to "trim the canvas" of the image generated? It's transparent, >but still have a "padding", if it would be cropped, I can safe almost >200px!. I have attached a file to this email to show it, the background of >the graph was set to red only to you see the padding. >2. In the file attached to this email, the graph have a space after the >position 23:00, I wish to remove it. > > > On Mon, Jul 27, 2009 at 1:37 PM, Jae-Joon Lee wrote: > >> On Mon, Jul 27, 2009 at 11:55 AM, Tony S Yu wrote: >> > The 3rd issue is a bit more difficult. One approach is to use >> > Jae-Joon's AxesGrid toolkit; you >> > >> may need to be using the latest development version of matplotlib to use the >> toolkit. >> >> I think it would be easier to use the recently added spine support, >> because using the AxesGrid toolkit has some side-effects. >> >> >> http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html >> >> Regards, >> >> -JJ >> > > > > -- > > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- Gökhan -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Design questions
Thanks everyone. Everything works perfectly. Only a few things left: 1. How to "trim the canvas" of the image generated? It's transparent, but still have a "padding", if it would be cropped, I can safe almost 200px!. I have attached a file to this email to show it, the background of the graph was set to red only to you see the padding. 2. In the file attached to this email, the graph have a space after the position 23:00, I wish to remove it. On Mon, Jul 27, 2009 at 1:37 PM, Jae-Joon Lee wrote: > On Mon, Jul 27, 2009 at 11:55 AM, Tony S Yu wrote: > > The 3rd issue is a bit more difficult. One approach is to use > > Jae-Joon's AxesGrid toolkit; you > > > may need to be using the latest development version of matplotlib to use the > toolkit. > > I think it would be easier to use the recently added spine support, > because using the AxesGrid toolkit has some side-effects. > > > http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html > > Regards, > > -JJ > <>-- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ipython --pylab without namespace pollution?
On Mon, Jul 27, 2009 at 2:40 PM, Christopher Barker wrote: > Ryan May wrote: > >> > Put this in your ~/.ipython/ipythonrc: >> > >> > pylab_import_all 0 >> > > I finally got around to doing this, and found: > > # === > # Deprecation note: you should look into modifying ipy_user_conf.py > (located > # in ~/.ipython or ~/_ipython, depending on your platform) instead, it's a > # more flexible and robust (and better supported!) configuration > # method. > # === > > So I took that to heart, and added: > >o.pylab_import_all = 0 > > > to my ipy_user_conf.py file, and that had the same effect. Good to know. When I get around to that FAQ entry, I'll be sure to include that nugget. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] problems with contourf plots
Paul Anton Letnes wrote: > Hi, > > > I'm having strange problems with contourf plots. The plotting routine is > rather elaborate, so I don't have an easy way to reproduce the problem > (unfortunately). The problem should be evident from the attachments. As > you can see, the contourf routine doesn't color the whole plot area. > Also, after some editing in Adobe Illustrator, it is also easy to see > that some contours are drawn on top of others. This must surely be a bug? It is in your data file and/or your handling of it, not in contourf. The problem is that your theta variable is not monotonic--it starts and ends with zero. If you chop off the last line of your data file, or equivalently chop off the last column of each array after you read it, like this: return thetas[:,:-1], freqs[:,:-1], Es[:,:-1] then the contouring works fine. Eric > > I would like to note that this happened on the TkAgg (using show()), Agg > (png format), ps (eps format), macosx (using show()) and pdf backends. > Also, for some data sets, the plot turns out just fine - I get this > problem only for some data sets. I have no idea how to debug this, so > I'd appreciate any hints you might provide. > > The file original.pdf shows the matplotlib result. The file edited.pdf > shows that you have contours on top of each other. The file gnuplot.png > gives an idea of what the end result should be: a lot of bumps around > 3.5 eV, but some of this structure is missing from the contourf plots. > The gnuplot plot was generated from the same data (ASCII text) file. > > > Best regards, > Paul. > > > > > > > > > -- > > > > > ___ > 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
[Matplotlib-users] question about legend
Hi all i am making a scatter plot and want to label one of the points in the legend. i run scatter([x], [y], ..., label="mylabel") and then run legend as follows plt.legend(loc='lower right', numpoints=1, pad=0.01, labelsep=.01, handlelen=.05) i set numpoints=1 because i want it to show just one point and then its label. however, this always generates a legend with three points, i.e. o o o my label rather than o mylabel does anyone know how to fix this? thank you. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ipython --pylab without namespace pollution?
Ryan May wrote: > > Put this in your ~/.ipython/ipythonrc: > > > > pylab_import_all 0 I finally got around to doing this, and found: # === # Deprecation note: you should look into modifying ipy_user_conf.py (located # in ~/.ipython or ~/_ipython, depending on your platform) instead, it's a # more flexible and robust (and better supported!) configuration # method. # === So I took that to heart, and added: o.pylab_import_all = 0 to my ipy_user_conf.py file, and that had the same effect. thanks, -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] square plots with linear equal axes -- help
Well, I think the meaning of the axis("equal") is a bit misleading (at least to me), but if you look at the documentation, it says that it changes the xlimit and ylimit (limits in data coordinate), so this is NOT what you want. What you need is axis("scaled") or axis("image"). http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.axis With this, you will have square axes regardless of the figure size or subplot params (assuming that the x- and y- data limits are same). Regards, -JJ On Sun, Jul 26, 2009 at 8:43 PM, kbkb wrote: > > Thanks for trying to help Andreas. > > Those suggestions did not really solve the problem, but I did realize where > I was going astray and post that information here to help others. I did see > others new to the libraries looking for similar help. > > First the conceptual misunderstanding: I did not realize the 'figure size', > as set by something like > plt.gcf().set_size_inches(6,6) includes all area: white plot area, grey > surrounding area, labels, etc. Everything inside the window frame. A bad > coincidence slowed my realization. I measured the white area inside the > axis to be 480x464 pixels, which at 80 dpi worked almost for a 6x6. So, I > thought it was close but off just a bit. But, I had set the dpi to 100, and > the total frame was exactly 600x600 as it should be. The dimensions of the > plot area inside the axes was being set automatically, and just > coincidentally worked out to be 480 in one dimension. > > Solution to get truly square plots of known size with axis scale set: > fig = plt.gcf() > fig.set_dpi(100) # or whatever you like > fig.set_size_inches((6.0,6.0),forward=True) #for example > # to control the fraction of the total area set aside for axis tick mark > labels, etc. > # this is key to keeping the interior plot area square > plt.subplots_adjust(left=0.10,bottom=0.10,right=0.95,top=0.95) > ## plt.axis('equal') # I had this for a while but do not think it > useful > plt.gca().grid(True) > # to keep the axis scale from being automatically changed as line2d > objects are added or removed > plt.gca().set_autoscale_on(False) > plt.axis([1.0,9.0,1.0,9.0]) # set the axis scale as appropriate > plt.show() > fig.canvas.draw() > > Cheers > Kersey > > -- > View this message in context: > http://www.nabble.com/square-plots-with-linear-equal-axes-help-tp24638812p24672100.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > -- > ___ > 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] Design questions
On Mon, Jul 27, 2009 at 11:55 AM, Tony S Yu wrote: > The 3rd issue is a bit more difficult. One approach is to use > Jae-Joon's AxesGrid toolkit; you > may need to be using the latest development version of matplotlib to use the toolkit. I think it would be easier to use the recently added spine support, because using the AxesGrid toolkit has some side-effects. http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html Regards, -JJ -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Design questions
Below is some code to do 1, 2, and 4. The 3rd issue is a bit more difficult. One approach is to use Jae- Joon's AxesGrid toolkit; you may need to be using the latest development version of matplotlib to use the toolkit. BTW, does anyone know why it's ``ax.set_axis_bgcolor`` instead of ``ax.set_facecolor``? Best, -Tony % == import numpy as np import matplotlib.pyplot as plt fig = plt.figure(frameon=False) ax = plt.gca() light_gray = (.8, .8, .8) dark_gray = (.2, .2, .2) x = np.random.random_integers(1, 10, 50) n, bins, patches = ax.hist(x, facecolor='#658A2F') for p in patches: p.set_edgecolor(dark_gray) ax.set_axis_bgcolor(light_gray) ax.yaxis.grid(color='w', linestyle='-') # Assuming you want the gridlines below the bars ax.set_axisbelow(True) plt.show() On Jul 27, 2009, at 11:22 AM, Gewton Jhames wrote: thanks!! only 4 left. On Mon, Jul 27, 2009 at 11:31 AM, Gökhan SEVER wrote: For the 5th one ;) figure(frameon=False) On Mon, Jul 27, 2009 at 8:26 AM, Gewton Jhames wrote: Hello, would you help me in some design issues that I wish to put in my matplotlib graph? I want my graph look like the one that I'm attaching on this email: Change the Background-color of the axis to gray; Display only horizontal lines on the axis, in white color; Display only the border-left and the border-bottom of the graph, and in 2px of width; Change the border-color of the bars of the graphics (to a more dark gray). Save in a transparent png. Can anyone know how to change any of these features? thanks. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Gökhan -- ___ 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] imshow with side plots whitespace problem
Jae-Joon Lee, The data file I worked with is: The file 'unl-1mm-3d_MagMultiField_25.h5' (370.0 MB) is available for download at < http://dropbox.unl.edu/uploads/20090803/b42af1d24f319f10/unl-1mm-3d_MagMultiField_25.h5 > for the next 7 days. It will be removed after Monday, August 3, 2009. It contains a 4D array which we make into a 3D array. Then that is worked with. Adding the keyword argument aspect = 'auto' works for now. Though, in the future I am not sure this will work for plotting data in different ways. Today I will look into using the divider commands you give. Thanks, Jeff Thomas On Sat, Jul 25, 2009 at 2:07 PM, Jae-Joon Lee wrote: > The axes_grid toolkit is base on use cases for images of aspect 1, and > I haven't carefully considered cases where the aspect is different > from 1. And I guess this is one of such cases I overlooked. > > Please try to add below lines in your code (I couldn't try your code > because of the missing data file, but it works with the the scatter > example you referred). > > > ax.set_aspect("auto") > divider.set_aspect(True) > divider.get_horizontal()[0]._aspect=0.5 > > The interface should be improved but I guess this will work. > > Regards, > > -JJ > > > On Fri, Jul 24, 2009 at 1:19 PM, Jeff Thomas > wrote: > > Currently, I am trying to plot a 2D array with imshow and two 1D arrays > > on separate plots attached to the top and right of the imshow image. I > got > > it to work, however when I change the aspect of the image (which I want > to > > do) white space and unusual scalings appear. I want to get rid of it and > > have the scales that match the aspect. > > Basically, I want to do the same thing shown in the > > example > http://matplotlib.sourceforge.net/examples/axes_grid/scatter_hist.html > > attached is the result with out the aspect change. > > also attached is the result with aspect change attempt. > > here is the code that produces the result above: > > import numpy as np > > import tables > > from matplotlib.pyplot import * > > import matplotlib as mpl > > import matplotlib.cm as cm > > > > > > fig = figure(figsize=[12.5,7.5]) > > from mpl_toolkits.axes_grid import make_axes_locatable > > #get 3D array from hdf5 file > > a = > > > tables.openFile("/Users/magoo/vorpal-data-2/unl-1mm-3d_ElecMultiField_25.h5") > > b = a.root.ElecMultiField[ : , : , : ,1] > > ax = fig.add_subplot(111) > > ax.set_autoscale_on(False) > > divider = make_axes_locatable(ax) > > axLOutx = divider.new_vertical(1, pad=0.3, sharex=ax) > > fig.add_axes(axLOutx) > > #plot line above > > axLOutx.plot(b[365,:,75]) > > axLOutx.set_xlim( (0,145)) > > axLOuty = divider.new_horizontal(2, pad=0.5, sharey=ax) > > fig.add_axes(axLOuty) > > #plot line on right > > yarr = np.arange(0, np.shape(b[:, 75, 75])[0], 1) > > axLOuty.plot(b[:,75,75], yarr) > > axLOuty.set_ylim( (769,0)) > > # plot image/2D array > > im = ax.imshow(b[:,:,75], extent=[0,145,769,0],cmap=cm.jet) # when I add > > (aspect = .5) as another argument I get what is shown in the second > attached > > image > > cb = colorbar(im, fraction=0.015) > > > > plt.draw() > > plt.show() > > > -- > > > > ___ > > 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] Design questions
thanks!! only 4 left. On Mon, Jul 27, 2009 at 11:31 AM, Gökhan SEVER wrote: > For the 5th one ;) > > figure(frameon=False) > > On Mon, Jul 27, 2009 at 8:26 AM, Gewton Jhames wrote: > >> Hello, would you help me in some design issues that I wish to put in my >> matplotlib graph? >> I want my graph look like the one that I'm attaching on this email: >> >> >>- Change the Background-color of the axis to gray; >>- Display only horizontal lines on the axis, in white color; >>- Display only the border-left and the border-bottom of the graph, and >>in 2px of width; >>- Change the border-color of the bars of the graphics (to a more dark >>gray). >>- Save in a transparent png. >> >> >> Can anyone know how to change any of these features? thanks. >> >> >> -- >> >> ___ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> > > > -- > Gökhan > -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Design questions
For the 5th one ;) figure(frameon=False) On Mon, Jul 27, 2009 at 8:26 AM, Gewton Jhames wrote: > Hello, would you help me in some design issues that I wish to put in my > matplotlib graph? > I want my graph look like the one that I'm attaching on this email: > > >- Change the Background-color of the axis to gray; >- Display only horizontal lines on the axis, in white color; >- Display only the border-left and the border-bottom of the graph, and >in 2px of width; >- Change the border-color of the bars of the graphics (to a more dark >gray). >- Save in a transparent png. > > > Can anyone know how to change any of these features? thanks. > > > -- > > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- Gökhan -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Design questions
Hello, would you help me in some design issues that I wish to put in my matplotlib graph? I want my graph look like the one that I'm attaching on this email: - Change the Background-color of the axis to gray; - Display only horizontal lines on the axis, in white color; - Display only the border-left and the border-bottom of the graph, and in 2px of width; - Change the border-color of the bars of the graphics (to a more dark gray). - Save in a transparent png. Can anyone know how to change any of these features? thanks. <>-- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] speeding-up griddata()
in interpolate_one might be the time hog; I see claims that plain is faster. StackVector in http://stackoverflow.com/questions/354442/looking-for-c-stl-like-vector-class-but-using-stack-storage looks nice, but I haven't timed it myself. cheers -- denis -- View this message in context: http://www.nabble.com/speeding-up-griddata%28%29-tp24467055p24679147.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users