[Matplotlib-users] Axes frame lineweights
Is there a way to reduce the lineweight of the axes frame edge? Alternatively, is there a way to hide the edge of the frame without turning the frame off? Thanks, Adam -- Why Cloud-Based Security and Archiving Make Sense Osterman Research conducted this study that outlines how and why cloud computing security and archiving is rapidly being adopted across the IT space for its ease of implementation, lower cost, and increased reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 1-10^-1 Custom Log Ticker
import matplotlib.ticker as tick def showOnlySomeTicks(x, pos): s = str(int(x)) if x == 5000: return'5e3'#'%.0e' % x return '' ax = plt.axes([0.165,0.2,0.95-0.24,0.95-0.2]) ax.xaxis.set_minor_formatter(tick.FuncFormatter(showOnlySomeTicks)) Then in the code something just change xaxis to yaxis or vice versa. Can also set the major formatter like this. Not sure if this is what you were looking for but it seems you want custom tick labels. Can also set the location of the ticks and check ticker page below for more info. For setting a different base check the multiplelocater from the ticker class here: http://matplotlib.sourceforge.net/api/ticker_api.html On 09/07/2011 08:03 PM, shaunh1 wrote: Hi, As the subject shows, I am trying to create a custom ticker (class??) that has pretty formatted log tick. Instead of just 10^-5, 10^-5, etc, is something more like [1-10^-2, 1-10^-3, 1-10^-4] etc I am histogram'n a set of data that is very close to 1, basically ranging from 0.990 and 0.9922, but mostly being centered on 0.9921. I would love to see meaningful labels. Any ideas? -- Why Cloud-Based Security and Archiving Make Sense Osterman Research conducted this study that outlines how and why cloud computing security and archiving is rapidly being adopted across the IT space for its ease of implementation, lower cost, and increased reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] one pixel white border : bug ?
On 09/08/2011 06:09 PM, Benjamin Root wrote: On Thu, Sep 8, 2011 at 10:30 AM, Yves Revaz yves.re...@epfl.ch mailto:yves.re...@epfl.ch wrote: Dear List, when I'm saving a plot with the option facecolor='k', around my image, there is still a one pixel white border. How is it possible to remove this ? try for example this very simple script: (using ) import pylab as pt from numpy import * x = arange(0,10) y = x**2 pt.plot(x,y) pt.savefig('qq.png',facecolor='k') Thanks in advance. yves yves, This might depend on the version of matplotlib and which backend you are using. I currently do not see this white line on my development build of mpl using the GTKAgg backend. What are you using? Hi Ben, Thanks for you reply. I'm using : import matplotlib matplotlib.__version__ '1.0rc1' with the GTKAgg backend. I join a zoom of a corner of the image to show that there is one white line and a second gray one. I tried different backend, with some of them (XV, GTKCairo), the white line disapears but in all cases, the gray line is present :-( . Do you really have nothing like that ? Thanks, yves Ben Root -- (o o) oOO--(_)--OOo--- Dr. Yves Revaz Laboratory of Astrophysics Ecole Polytechnique Fédérale de Lausanne (EPFL) Observatoire de Sauverny Tel : ++ 41 22 379 24 28 51. Ch. des Maillettes Fax : ++ 41 22 379 22 05 1290 Sauverny e-mail : yves.re...@epfl.ch SWITZERLAND Web : http://www.lunix.ch/revaz/ attachment: zoom.png-- Why Cloud-Based Security and Archiving Make Sense Osterman Research conducted this study that outlines how and why cloud computing security and archiving is rapidly being adopted across the IT space for its ease of implementation, lower cost, and increased reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Basemap/ orthographic projection plot doesn't respect globe boundary
2011/9/8 Jeff Whitaker jsw...@fastmail.fm: On 9/8/11 1:51 AM, Jakob Malm wrote: Picking up on an old thread. Hopefully Jeff is still listening in... On 2010-04-04 23:24, Jeff Whitaker wrote: On 4/4/10 11:06 AM, Will Hewson wrote: Hi again Jeff et al... I've had a play around with the extra few lines of code - on paper this seems like it should solve the problems I'm experiencing. However, an error's being thrown up by the transform scalar function, as my lons and lats won't necessarily be increasing. The data I'm plotting is satellite data and so at the beginning and end of the orbit file lats go over the pole from 90 to -90, with a similar problem for the lons - whereby the data is taken across the satellite track. I've thought about sorting the data before passing it to transform_scalar but I'm always going to be left with the problem in either lats or lons. I've uploaded the file I'm currently working with this time. It's three columns of lons, lats and z values. Once again, many thanks for your help. Will. http://old.nabble.com/file/p28133659/test.plt test.plt Will: Is it a regular lat/lon grid or a satellite swath? If it's the latter, you can't use my solution. -Jeff What if it _is_ a satellite swath? Can I get around the problem of off-projection plotting with Basemap.pcolormesh()? Example code and plots can be found at http://pythonbits.blogspot.com/2011/09/i-have-problem-with-basemap-plotting.html Thanks, Jakob Malm Jakob: I think that's the price you pay for the speed of pcolormesh (vs pcolor). It appears to make more assumptions about the structure of your data. I don't see any way around it. -Jeff Hmm... I believe I have been able to get around it previously, but perhaps I just fell back to using pcolor... Thanks, Jakob -- Why Cloud-Based Security and Archiving Make Sense Osterman Research conducted this study that outlines how and why cloud computing security and archiving is rapidly being adopted across the IT space for its ease of implementation, lower cost, and increased reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] it is possible to use basemap to create regular spaced lat/lon grids?
On 8 September 2011 19:20, Matt Funk matze...@gmail.com wrote: Hi, sorry that it has taken me so long to reply. Anyway, i could be wrong, but i don't think that the code: xi = np.linspace(llcrnlon,urcrnlon,1000) yi = np.linspace(llcrnlat,urcrnlat,1000) will produce a grid which gives the lat/lon coordinates with 1km spacing. The reason being is that the distance between 2 lons (say -117.731659 and -91.303642) is different depending on where you are in terms of the latitude (i.e. the extreme examples are of course the north pole vs the equator). So the above gives a regular grid in terms of degrees but not in terms of distance. Yes, that's correct. You'll need to project your original data locations into a cartesian co-ordinate system before interpolating their values onto a regular grid in that co-ordinate system using griddata et al. You might like to use pyproj (included with the basemap toolkit) to help you project from lat/lon to your chosen co-ordinate system.. Cheers, Scott -- Why Cloud-Based Security and Archiving Make Sense Osterman Research conducted this study that outlines how and why cloud computing security and archiving is rapidly being adopted across the IT space for its ease of implementation, lower cost, and increased reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] exception in hit testing with log scale axes
I was trying to implement something where the user could change the properties of an artist by right clicking on it...so I needed to find out what artists are under the cursor at the time of the click. It is possible that the method that I'm using isn't the recommended one; if not, I would appreciate any suggestions. I'm using fig.hitlist() to get the list of artists. This function works just fine with a regular xy plot, but if one (or both) of the axes are in log scale, I get a NotImplementedError exception and associated stack trace (run the attached demo code to see). The exception is being caused by line 249 in artists.py. Now, if I modify artists.py slightly to swallow the exception, replacing for a in self.get_children(): L.extend(a.hitlist(event)) with try: for a in self.get_children(): L.extend(a.hitlist(event)) except: pass Then everything seems to work. However, being unfamiliar with the code, I'm not sure what else that might break, or how bad of an idea swallowing the exception is here. I have attached a small demo code. The error occurs in matplotlib 1.0.0 and matplotlib 1.0.1, on both Linux and Windows. -- Daniel Hyams dhy...@gmail.com hitlist_problem.py Description: Binary data -- Why Cloud-Based Security and Archiving Make Sense Osterman Research conducted this study that outlines how and why cloud computing security and archiving is rapidly being adopted across the IT space for its ease of implementation, lower cost, and increased reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] it is possible to use basemap to create regular spaced lat/lon grids?
On 9/9/2011 6:42 AM, Scott Sinclair wrote: On 8 September 2011 19:20, Matt Funk matze...@gmail.com wrote: Hi, sorry that it has taken me so long to reply. Anyway, i could be wrong, but i don't think that the code: xi = np.linspace(llcrnlon,urcrnlon,1000) yi = np.linspace(llcrnlat,urcrnlat,1000) will produce a grid which gives the lat/lon coordinates with 1km spacing. The reason being is that the distance between 2 lons (say -117.731659 and -91.303642) is different depending on where you are in terms of the latitude (i.e. the extreme examples are of course the north pole vs the equator). So the above gives a regular grid in terms of degrees but not in terms of distance. Yes, that's correct. You'll need to project your original data locations into a cartesian co-ordinate system before interpolating their values onto a regular grid in that co-ordinate system using griddata et al. You might like to use pyproj (included with the basemap toolkit) to help you project from lat/lon to your chosen co-ordinate system.. I have been using gdal for many of my geographic needs. Is there an advantage/disadvantage using pyproj vs capabilities found in gdal (from what i understand both are based on PROJ.4)? Can you comment on this? Also, i was thinking of projecting things to UTM for interpolation purposes. Is there any apparent reason this is a bad idea vs a different projected coordinate system? matt Cheers, Scott -- Why Cloud-Based Security and Archiving Make Sense Osterman Research conducted this study that outlines how and why cloud computing security and archiving is rapidly being adopted across the IT space for its ease of implementation, lower cost, and increased reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Matt Funk Research Associate Plant and Environmental Scienc. Dept. New Mexico State University -- Why Cloud-Based Security and Archiving Make Sense Osterman Research conducted this study that outlines how and why cloud computing security and archiving is rapidly being adopted across the IT space for its ease of implementation, lower cost, and increased reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] one pixel white border : bug ?
On Fri, Sep 9, 2011 at 3:49 AM, Yves Revaz yves.re...@epfl.ch wrote: ** On 09/08/2011 06:09 PM, Benjamin Root wrote: On Thu, Sep 8, 2011 at 10:30 AM, Yves Revaz yves.re...@epfl.ch wrote: Dear List, when I'm saving a plot with the option facecolor='k', around my image, there is still a one pixel white border. How is it possible to remove this ? try for example this very simple script: (using ) import pylab as pt from numpy import * x = arange(0,10) y = x**2 pt.plot(x,y) pt.savefig('qq.png',facecolor='k') Thanks in advance. yves yves, This might depend on the version of matplotlib and which backend you are using. I currently do not see this white line on my development build of mpl using the GTKAgg backend. What are you using? Hi Ben, Thanks for you reply. I'm using : import matplotlib matplotlib.__version__ '1.0rc1' That version is over a year old. Since then, I know that some off-by-one pixel bugs have been fixed. with the GTKAgg backend. I join a zoom of a corner of the image to show that there is one white line and a second gray one. I tried different backend, with some of them (XV, GTKCairo), the white line disapears but in all cases, the gray line is present :-( . Do you really have nothing like that ? No, not in the latest development version, but I haven't checked for a gray line. Then again, that may be dependent upon the graphics viewer. You could try installing v1.0.1 now, or wait a bit for the upcoming v1.1 release. I hope this helps! Ben Root -- Why Cloud-Based Security and Archiving Make Sense Osterman Research conducted this study that outlines how and why cloud computing security and archiving is rapidly being adopted across the IT space for its ease of implementation, lower cost, and increased reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] 2 x-axes
I have a semilog plot. I'd like to add a second x axis (maybe below the existing one, or else maybe on top of graph). This second x axis is simply describing the same existing data, in different units. For example imagine a plot of x - time in seconds y - velocity x2 - time in minutes -- Why Cloud-Based Security and Archiving Make Sense Osterman Research conducted this study that outlines how and why cloud computing security and archiving is rapidly being adopted across the IT space for its ease of implementation, lower cost, and increased reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] exception in hit testing with log scale axes [resend]
[resend: apologies for the html mail]. I was trying to implement something where the user could change the properties of an artist by right clicking on it...so I needed to find out what artists are under the cursor at the time of the click. It is possible that the method that I'm using isn't the recommended one; if not, I would appreciate any suggestions. I'm using fig.hitlist() to get the list of artists. This function works just fine with a regular xy plot, but if one (or both) of the axes are in log scale, I get a NotImplementedError exception and associated stack trace (run the attached demo code to see). The exception is being caused by line 249 in artists.py. Now, if I modify artists.py slightly to swallow the exception, replacing for a in self.get_children(): L.extend(a.hitlist(event)) with try: for a in self.get_children(): L.extend(a.hitlist(event)) except: pass Then everything seems to work. However, being unfamiliar with the code, I'm not sure what else that might break, or how bad of an idea swallowing the exception is here. I have attached a small demo code. The error occurs in matplotlib 1.0.0 and matplotlib 1.0.1, on both Linux and Windows. -- Daniel Hyams dhy...@gmail.com hitlist_problem.py Description: Binary data -- Why Cloud-Based Security and Archiving Make Sense Osterman Research conducted this study that outlines how and why cloud computing security and archiving is rapidly being adopted across the IT space for its ease of implementation, lower cost, and increased reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] one pixel white border : bug ?
Ben and Yves, Might this be behavior defined in the matplotlibrc file? In [21]: import matplotlib as mpl In [22]: mpl.rcParams['figure.edgecolor'] Out[22]: 'w' -paul On Fri, Sep 9, 2011 at 9:37 AM, Benjamin Root ben.r...@ou.edu wrote: On Fri, Sep 9, 2011 at 3:49 AM, Yves Revaz yves.re...@epfl.ch wrote: On 09/08/2011 06:09 PM, Benjamin Root wrote: On Thu, Sep 8, 2011 at 10:30 AM, Yves Revaz yves.re...@epfl.ch wrote: Dear List, when I'm saving a plot with the option facecolor='k', around my image, there is still a one pixel white border. How is it possible to remove this ? try for example this very simple script: (using ) import pylab as pt from numpy import * x = arange(0,10) y = x**2 pt.plot(x,y) pt.savefig('qq.png',facecolor='k') Thanks in advance. yves yves, This might depend on the version of matplotlib and which backend you are using. I currently do not see this white line on my development build of mpl using the GTKAgg backend. What are you using? Hi Ben, Thanks for you reply. I'm using : import matplotlib matplotlib.__version__ '1.0rc1' That version is over a year old. Since then, I know that some off-by-one pixel bugs have been fixed. with the GTKAgg backend. I join a zoom of a corner of the image to show that there is one white line and a second gray one. I tried different backend, with some of them (XV, GTKCairo), the white line disapears but in all cases, the gray line is present :-( . Do you really have nothing like that ? No, not in the latest development version, but I haven't checked for a gray line. Then again, that may be dependent upon the graphics viewer. You could try installing v1.0.1 now, or wait a bit for the upcoming v1.1 release. I hope this helps! Ben Root -- Why Cloud-Based Security and Archiving Make Sense Osterman Research conducted this study that outlines how and why cloud computing security and archiving is rapidly being adopted across the IT space for its ease of implementation, lower cost, and increased reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Why Cloud-Based Security and Archiving Make Sense Osterman Research conducted this study that outlines how and why cloud computing security and archiving is rapidly being adopted across the IT space for its ease of implementation, lower cost, and increased reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 2 x-axes
Neal Becker wrote: I have a semilog plot. I'd like to add a second x axis (maybe below the existing one, or else maybe on top of graph). This second x axis is simply describing the same existing data, in different units. For example imagine a plot of x - time in seconds y - velocity x2 - time in minutes This almost works: fig = plt.figure() ax = fig.add_subplot(111) ... ax2 = ax.twiny() min_x, max_x = ax.get_xlim() ax2.set_xlim (min_x-1, max_x-1) except the 2nd x axis is on the top, and prints right on top of the title -- Why Cloud-Based Security and Archiving Make Sense Osterman Research conducted this study that outlines how and why cloud computing security and archiving is rapidly being adopted across the IT space for its ease of implementation, lower cost, and increased reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 2 x-axes
Hi, The code below should create a properly placed 2nd x-axis. You might need to adjust the placement of the figure canvas to match into the window. import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.axes_grid.parasite_axes import SubplotHost fig = plt.figure(figsize=(10,8)) host = SubplotHost(fig, 111) fig.add_subplot(host) parx = host.twiny() parx.axis[top].set_visible(False) offset = 0, -50 new_axisline = parx.get_grid_helper().new_fixed_axis parx.axis[bottom] = new_axisline(loc=bottom, axes=parx, offset=offset) parx.axis[bottom].label.set_visible(True) hplt, = host.plot(np.random.rand(100)) p2, = parx.plot(np.linspace(0,20,100), np.random.rand(100)*5.0, color='green') plt.show() There is also another example at: http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#axisartist-with-parasiteaxes Hope this helps. On Fri, Sep 9, 2011 at 12:50 PM, Neal Becker ndbeck...@gmail.com wrote: Neal Becker wrote: I have a semilog plot. I'd like to add a second x axis (maybe below the existing one, or else maybe on top of graph). This second x axis is simply describing the same existing data, in different units. For example imagine a plot of x - time in seconds y - velocity x2 - time in minutes This almost works: fig = plt.figure() ax = fig.add_subplot(111) ... ax2 = ax.twiny() min_x, max_x = ax.get_xlim() ax2.set_xlim (min_x-1, max_x-1) except the 2nd x axis is on the top, and prints right on top of the title -- Why Cloud-Based Security and Archiving Make Sense Osterman Research conducted this study that outlines how and why cloud computing security and archiving is rapidly being adopted across the IT space for its ease of implementation, lower cost, and increased reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Gökhan -- Why Cloud-Based Security and Archiving Make Sense Osterman Research conducted this study that outlines how and why cloud computing security and archiving is rapidly being adopted across the IT space for its ease of implementation, lower cost, and increased reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] canvas.draw() memory issue? (PyQt4)
Hi all, I am encountering a memory leak type issue when running the following, for example. http://codepad.org/TNuCLT3k Matplotlib version: 0.99.3 PyQt4 Version: 4.8.5 I found a thread in the archive relating to this issue which supposedly disappeared upon updating to PyQt 4.8.4 (I trust it would not have been reintroduced in going to .5). Can someone confirm or deny replication of this issue with their setup and/or offer a solution? Thanks very much Matt Earnshaw -- Why Cloud-Based Security and Archiving Make Sense Osterman Research conducted this study that outlines how and why cloud computing security and archiving is rapidly being adopted across the IT space for its ease of implementation, lower cost, and increased reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users