Re: [Matplotlib-users] Plotting a vector in matplotlib

2010-05-03 Thread Joe Kington
Isn't that what quiverhttp://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.quiverdoes? Or am I misunderstanding the question? 2010/5/3 aditya bhargava bluemangrou...@gmail.com Thanks Johan and Matthias, I was just wondering if there was a built-in way to do this in

Re: [Matplotlib-users] matplotlib and large array

2010-06-09 Thread Joe Kington
One workaround is to try converting it to a PIL image first. For whatever reason, imshow chokes on large arrays, but handles PIL images of the same array just fine. However, you'll need to set the colormap and such through PIL, which can be a bit frustrating if you're unfamiliar with it. Also,

Re: [Matplotlib-users] Reverse y-axis?

2010-06-25 Thread Joe Kington
There's no single function to do it, but just reversing the current ylimits manually is a one-liner. (plt is matplotlib.pyplot, here) plt.ylim(plt.ylim()[::-1]) Hope that helps, -Joe On Fri, Jun 25, 2010 at 6:41 AM, Preben Randhol rand...@pvv.org wrote: Hi I need to plot some data vs

Re: [Matplotlib-users] extract country borders data convert to shapefile

2010-06-30 Thread Joe Kington
If you just need the GSHHS data in shapefile format, it's available on the NOAA GSHHS website http://www.ngdc.noaa.gov/mgg/shorelines/gshhs.html. If you prefer a direct link [96MB zip file]: http://www.ngdc.noaa.gov/mgg/shorelines/data/gshhs/version2.0/shapefiles/gshhs_shp_2.0.zip Hope that

Re: [Matplotlib-users] extract country borders data convert to shapefile

2010-06-30 Thread Joe Kington
Ah, sorry I misunderstood. You can get them by using GMT's gshhs tool (or just using pscoast with the right options) to dump out the political borders in GMT format and then convert them to a shapefile using ogr2org (or whichever tool you find easiest... Personally I use the python wrappers

Re: [Matplotlib-users] Smooth contourplots

2010-07-26 Thread Joe Kington
It sounds like you're wanting a gaussian kernel density estimate (KDE) (not the desktop!). The other options you mentioned are for interpolation, and are not at all what you're wanting to do. You can use

Re: [Matplotlib-users] Fit a plane to a set of xyz points

2010-07-27 Thread Joe Kington
On Tue, Jul 27, 2010 at 1:37 PM, Friedrich Romstedt friedrichromst...@gmail.com wrote: 2010/7/26 Mathew Yeates mat.yea...@gmail.com: Is there a simple function call for this? And finding the distance of a point to the plane? Hmm, when you are interested in the z distance alone, it should

[Matplotlib-users] Setting y-tick locations on an image plot changes y-axis limits, Bug or expected behavior?

2010-08-20 Thread Joe Kington
Hi, I've recently noticed that setting the y-tick locations on an image plot changes the y-axis limits, while changing the x-tick locations does not change the x-axis limits. I wouldn't have expected either to change the axis limits, but it seems quite inconsistent that the y-axis and x-axis

Re: [Matplotlib-users] Setting y-tick locations on an image plot changes y-axis limits, Bug or expected behavior?

2010-08-21 Thread Joe Kington
Thanks for the amazingly quick turnaround! -Joe On Sat, Aug 21, 2010 at 1:34 PM, Eric Firing efir...@hawaii.edu wrote: On 08/20/2010 12:18 PM, Joe Kington wrote: Hi, I've recently noticed that setting the y-tick locations on an image plot changes the y-axis limits, while changing the x

Re: [Matplotlib-users] Adding a Legend

2010-09-20 Thread Joe Kington
On Sun, Sep 19, 2010 at 10:40 PM, Kelson Zawack zawack...@gis.a-star.edu.sg wrote: Is there a way to put the legend for a graph inside the margin instead of on the graph, in other words to put the legend where excel would? Look into either

Re: [Matplotlib-users] sector colouring?

2010-09-27 Thread Joe Kington
Have a look at fill_between: http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.fill_between Basically, You'd want something like this: import matplotlib.pyplot as plt import numpy as np x = np.linspace(0, np.pi, 20) y = np.sin(x) plt.figure() plt.fill_between(x, y,

Re: [Matplotlib-users] How to find out the extend of the actual image in pixels

2010-09-29 Thread Joe Kington
If you're just looking for the dimensions of the overall figure in pixels, you can easily access them through other means. E.g: import matplotlib.pyplot as plt fig = plt.figure() _, _, width, height = fig.bbox.extents # - Extent of the figure in pixels fig.savefig('temp.png', dpi=fig.dpi) # - Be

[Matplotlib-users] Auto-wrapping text within a plot... Is there a simpler solution?

2010-11-01 Thread Joe Kington
Hi folks, First off, I apologize for the wall of text... Spurred on by this Stack Overflow questionhttp://stackoverflow.com/questions/4018860/text-box-in-matplotlib/4056853#4056853, and by an itch I've been wanting to scratch lately, I put together a a callback function that (attempts, anyway)

Re: [Matplotlib-users] Auto-wrapping text within a plot... Is there a simpler solution?

2010-11-02 Thread Joe Kington
For whatever it's worth, after a lot of wrangling, I think I solved most of my problems (though perhaps not in the most efficient way). In case anyone else is looking for similar functionality, here's a callback function that will autowrap text objects to the inside of the axis they're plotted

Re: [Matplotlib-users] Pixel shape

2011-04-18 Thread Joe Kington
Actually, I think he's wanting a set aspect, right? Either way, it's just aspect=1.5 or aspect=0.6667 depending on the orientation he wants. On Mon, Apr 18, 2011 at 6:37 AM, Sebastian Berg sebast...@sipsolutions.netwrote: The solution is already the aspect='auto', ie: import numpy as np

Re: [Matplotlib-users] Getting axis limits through ax.axis() turns off autoscaling. Confusing behavior?

2011-05-15 Thread Joe Kington
Thanks! -Joe On Sun, May 15, 2011 at 12:50 AM, Eric Firing efir...@hawaii.edu wrote: On 05/14/2011 12:22 PM, Joe Kington wrote: Hi, When getting an axis's extents through axis, the autoscaling state of the axis is turned off, regardless of the state it was in before calling ax.axis

Re: [Matplotlib-users] Plotting in loop problem, not refreshing

2011-06-04 Thread Joe Kington
Your code should work (and does on my system)... What backend, version of matplotlib, OS, etc are you running? On Sat, Jun 4, 2011 at 4:54 PM, Armin G armi...@gmail.com wrote: Hi everyone , I know this has been posted several times now, But I could not understand qietly why my simple code

Re: [Matplotlib-users] how to hide axes in a 3D plot

2011-09-07 Thread Joe Kington
. The axes are still not disappearing, nor do they disappear when I interact with it (by rotating the plot). -- Matt On Wed, Sep 7, 2011 at 3:21 PM, Benjamin Root ben.r...@ou.edu wrote: On Wed, Sep 7, 2011 at 2:14 PM, Joe Kington jking...@wisc.edu wrote: This no longer seems to work

Re: [Matplotlib-users] Ternary Plot

2011-11-03 Thread Joe Kington
The link on Nabble is broken, so here's (I think) a fixed version. It looks like the name of the branch was changed slightly at some point. https://github.com/kdavies4/matplotlib/compare/master...ternary2 Cheers, -Joe On Thu, Nov 3, 2011 at 3:14 PM, Benjamin Root ben.r...@ou.edu wrote: On

Re: [Matplotlib-users] Newbie question

2011-11-09 Thread Joe Kington
On Wed, Nov 9, 2011 at 10:07 AM, Howard how...@renci.org wrote: Hi all I'm a new user to matplotlib, and I'm having a little difficulty with something I feel must be basic. When I plot our data, I'm using a canvas that is 4x4 at 128 DPI and saving the canvas as a png. Here's the basics of

Re: [Matplotlib-users] Newbie question

2011-11-09 Thread Joe Kington
On Wed, Nov 9, 2011 at 10:20 AM, Howard how...@renci.org wrote: On 11/9/11 11:13 AM, Joe Kington wrote: On Wed, Nov 9, 2011 at 10:07 AM, Howard how...@renci.org wrote: Hi all I'm a new user to matplotlib, and I'm having a little difficulty with something I feel must be basic. When I

Re: [Matplotlib-users] Time axis for imshow

2011-11-10 Thread Joe Kington
On Wed, Nov 9, 2011 at 11:45 PM, Gökhan Sever gokhanse...@gmail.com wrote: Hello, Is there any easy way to specify a time-axis using imshow to plot 2D data? Sure, just call ax.xaxis_date() (or yaxis_date, depending on which axis you want to represent a date). As a quick example: import

Re: [Matplotlib-users] Time axis for imshow

2011-11-10 Thread Joe Kington
(SecondLocator(interval=5)) gives me better control over the major/minor ticks. On Thu, Nov 10, 2011 at 8:15 AM, Joe Kington jking...@wisc.edu wrote: On Wed, Nov 9, 2011 at 11:45 PM, Gökhan Sever gokhanse...@gmail.comwrote: Hello, Is there any easy way to specify a time-axis using imshow to plot

Re: [Matplotlib-users] Newbie-question: spines with arrows

2012-06-17 Thread Joe Kington
It sounds like you were using the right approach, you just got a bit lost on what some of the keyword parameters to annotate, etc do. Here's an example that should do what you want: import matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator fig, ax = plt.subplots() # Set the

[Matplotlib-users] ANN: mplstereonet v0.2 - Stereonets for matplotlib

2012-09-09 Thread Joe Kington
- Geometric analysis utilities (e.g. plane intersections) Thank you all very much! -Joe Kington -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has

Re: [Matplotlib-users] plot with marker color coded according to z-value

2012-10-19 Thread Joe Kington
That's what ``scatter`` is intended for. Basically, you want something like: plt.scatter(x, y, c=z, marker='s') plt.colorbar() Note that you can also vary the markers by size based on an additional parameter, as well. Have a look at this example:

Re: [Matplotlib-users] Undocumented transform API change between 1.1 and 1.2?

2012-12-10 Thread Joe Kington
changes, but this one must have slipped the net. If you're still having problems with using the newer transform API, please shout and I'd be happy to have a look for you. Will do, thanks for the offer! All the best, Phil On 9 December 2012 22:10, Joe Kington joferking...@gmail.com wrote

[Matplotlib-users] Feedback on an implementation of a matlab-ish datacursor

2013-03-12 Thread Joe Kington
I recently got around to polishing up a snippet I've been using for quite awhile. https://github.com/joferkington/mpldatacursor/ and I was hoping to get some feeding on the current implementation. mpldatacursor allows a user to easily click on an artist and display a customizable, interactive

Re: [Matplotlib-users] Feedback on an implementation of a matlab-ish datacursor

2013-03-13 Thread Joe Kington
by setting its edgecolor to 'None'. This was because the contour created had two parts and I only wanted to show one of them. Anyone know a different way to do that? Regards, Jon On Tue, 2013-03-12 at 22:58 -0500, Joe Kington wrote: I recently got around to polishing up a snippet I've

Re: [Matplotlib-users] Evolution of the interface

2013-03-15 Thread Joe Kington
On Mar 15, 2013 10:01 AM, Christophe BAL projet...@gmail.com wrote: Hello, I really appreciate the work done by matplotlib but I really think that the interface must evolve. Here is a small example. object.set_something(...) object.get_something() It could be easier to use a

Re: [Matplotlib-users] Linewidths in data space?

2013-04-15 Thread Joe Kington
Apart from implementing this natively in matplotlib, I was thinking if I could work around this limitation for our purposes in the following way: My objects to draw will always sit in a Collection. I could derive my own Collection class with a draw() method that changes the linewidth of the

[Matplotlib-users] Fwd: Python Session at AGU 2013

2013-08-01 Thread Joe Kington
For anyone attending the AGU (American Geophysical Union) fall meeting this year, there will be a session on python and big data in the earth sciences. Abstract submission is still open until Aug. 6th. See below for more info. Cheers, -Joe -- Forwarded message -- From: IRIS

Re: [Matplotlib-users] Choosing optimal figure width/height automatically

2013-10-17 Thread Joe Kington
snip Unfortunately, figaspect is only an approximate solution, as it simply uses the aspect ration of the image for the whole figure (with axes and labels). I wonder how difficult it would be to teach matplotlib to tightly fit the axes around an image, and, ideally, output the figure

Re: [Matplotlib-users] Choosing optimal figure width/height automatically

2013-10-21 Thread Joe Kington
I just realized that I replied to this off-list. Sending back out to the entire list. (Sorry for the duplicate e-mail Christoph!) On Oct 18, 2013 6:11 AM, Christoph Groth christ...@grothesque.org wrote: Joe, thank you very much for your reply. So the figsize of a matplotlib plot is the

Re: [Matplotlib-users] Pick event after using Zoom to rectangle

2013-10-29 Thread Joe Kington
If you're asking how to do it interactively, just click on the zoom button again, and you should be able to fire pick events by clicking again. Hope that helps! -Joe On Oct 29, 2013 4:58 AM, Nils Wagner nils...@googlemail.com wrote: Hi all, How can I use a pick event when I have used Zoom to

Re: [Matplotlib-users] pick event for images

2013-10-30 Thread Joe Kington
On Oct 30, 2013 9:43 AM, Nils Wagner nils...@googlemail.com wrote: Hi all, How can I retrieve the corresponding color value in percent, when I click on the image ? You have to jump through a couple of hoops. Have a look at the _coords2index function in pick_info.py for mpldatacursor.

Re: [Matplotlib-users] pick event for images

2013-11-02 Thread Joe Kington
installed your package mpldatacursor and run the example image_example.py. Awesome ! Is there a chance to integrate it into matplotlib ? Nils On Wed, Oct 30, 2013 at 5:58 PM, Joe Kington joferking...@gmail.comwrote: On Oct 30, 2013 9:43 AM, Nils Wagner nils...@googlemail.com wrote: Hi all

Re: [Matplotlib-users] pick event for images

2013-11-02 Thread Joe Kington
strange that the FSF is using a license other than the (L)GPL. Does it also mean that who wants to contribute to your project must sign a copyright assignment to the FSF? I'm puzzled. Best, Daniele On 30/10/2013 17:58, Joe Kington wrote: On Oct 30, 2013 9:43 AM, Nils Wagner nils

Re: [Matplotlib-users] indicating directions on stereographic projection.

2013-11-06 Thread Joe Kington
Sourav - Are you by chance trying to make a stereonet? If so, your question makes a bit more sense. If that's what you're doing, have a look at mplstereonet. https://github.com/joferkington/mplstereonet It currently doesn't support polar stereonets, but that's something I've been meaning to add

[Matplotlib-users] Is there anything pcolor can do that pcolormesh can't?

2013-11-19 Thread Joe Kington
Until very recentlyhttp://stackoverflow.com/questions/20069545/2d-plotting-with-colors-like-spectrograms-magnitude-plots#comment29914445_20069545, I had somehow wound up with the impression that `pcolormesh` only handles rectilinear coordinate arrays, while `pcolor` can handle arbitrarily shaped

Re: [Matplotlib-users] Plotting with more than two y-axes (with twinx?)

2013-11-27 Thread Joe Kington
to accomplish was produced two years ago in a stackoverflow snippet by Joe Kington http://stackoverflow.com/questions/7733693/matplotlib-overlay-plots-with-different-scales , and shown in the first figure below. However, when I use his snippet in matplotlib 1.3.x, I get an output where the third axis

Re: [Matplotlib-users] Most generic way to wrap collections

2014-01-07 Thread Joe Kington
On Tue, Jan 7, 2014 at 2:29 PM, Adam Hughes hughesada...@gmail.com wrote: Sorry, quick followup. I did find the gallery example to plot multiple patches together: http://matplotlib.org/examples/api/patch_collection.html That's excellent. Now I guess my question is how best to generalize

[Matplotlib-users] OT: Just because you can...

2014-02-21 Thread Joe Kington
There's a bad meme here. Hope you'll forgive the distraction! import matplotlib.pyplot as plt import numpy as np def main(): t = np.linspace(0, 4*np.pi, 1000) fig, ax = plt.subplots() ax.plot(t, np.cos(t)) ax.plot(t, np.sin(t)) for _ in range(10): fig =

Re: [Matplotlib-users] multiplot in a for loop

2014-03-10 Thread Joe Kington
On Mar 10, 2014 1:00 PM, Gabriele Brambilla gb.gabrielebrambi...@gmail.com wrote: And how can I select in which position of the grid of plots put my errorbar plot? like axes[i].errorbar(...)? Exactly. Except that axes will be a 2d array if you have multiple rows and columns, so it would be

Re: [Matplotlib-users] Example showing differences between Mac O$ and Windows use

2014-03-13 Thread Joe Kington
That should be `matplotlib.use('TkAgg')`, not Agg. Agg is a non-interactive backend, while TkAgg is an interactive Tkinter wrapper around the Agg backend. On Thu, Mar 13, 2014 at 9:53 AM, Jeroen Hegeman jeroen.hege...@gmail.comwrote: Hi Christophe, This is (I think) a known limitation of the

Re: [Matplotlib-users] pick_event after zooming/panning stops working.

2014-08-21 Thread Joe Kington
I think the OP's desire is to have pick events fire after the zoom has been triggered. Currently, after you zoom (or pan), the zoom tool is still active until you click it again. Pick events won't fire while the zoom tool is the selected tool, and you have to manually de-select it (i.e. click

Re: [Matplotlib-users] Region within contour -- 2D array

2014-08-28 Thread Joe Kington
Why not just use boolean indexing? E.g. to find the region that falls between 5 and 10, do (z =5) (z = 10): In [1]: import numpy as np In [2]: x, y = np.mgrid[-10:10, -10:10] In [3]: z = np.hypot(x, y) In [4]: result = (z = 5) (z = 10) In [5]: result.astype(int) Out[5]: array([[0, 0, 0, 0,

Re: [Matplotlib-users] Inverting a datetime / plot_date y-axis

2014-09-16 Thread Joe Kington
A quick way to do this is ``ax.invert_yaxis()`` (and invert_xaxis() for the x-axis). That way you preserve auto-scaling and don't wind up with manually set axis limits. What you did should have worked, but ``ymin`` and ``ymax`` are probably datetime objects. ``ylim`` isn't smart enough to

Re: [Matplotlib-users] Basemap from proj4 string

2014-11-07 Thread Joe Kington
I agree that it would be useful, but basemap doesn't support EPSG codes, so this isn't fully possible in general. On a side note, if you're ever just wanting to transform coordinates, pyproj supports generic proj4 strings. (e.g. proj = pyproj.Proj(your_proj4_string)) It might be possible to

Re: [Matplotlib-users] Matplotlib-users Digest, Vol 102, Issue 39

2014-11-21 Thread Joe Kington
On Fri, Nov 21, 2014 at 10:42 AM, Pedro Marcal pedrovmar...@gmail.com wrote: @MariaLukis, I had to go through contortions to plot an arbitrary quadrilateral mesh, in 3D. I resolved it by storing every line plotted and retracing the best set to take me to the starting point of the quad I was

Re: [Matplotlib-users] Key events using nbagg backend

2014-12-04 Thread Joe Kington
Nbagg is non-interactive, similar to Agg. No events other than draw events are supported, as far as I know. I think there are long term plans to change that (eg, webagg and mplh5canvas), but it's a fairly tricky problem. How that helps clarify why things aren't working, anyway. -Joe On Dec 4,

Re: [Matplotlib-users] Key events using nbagg backend

2014-12-05 Thread Joe Kington
reply to e-mail without putting much thought into it. Thanks! -Joe On Thu, Dec 4, 2014 at 8:58 PM, Brendan Barnwell brenb...@brenbarn.net wrote: On 2014-12-04 15:40, Joe Kington wrote: Nbagg is non-interactive, similar to Agg. No events other than draw events are supported, as far as I

Re: [Matplotlib-users] Fwd: [matplotlib-devel] RFC: candidates for a new default colormap

2015-06-05 Thread Joe Kington
On Fri, Jun 5, 2015 at 11:15 AM, Joe Kington joferking...@gmail.com wrote: Hopefully I will have some time today to play around with the D option. I want to see if I can shift the curve a bit to include more yellows and orange so that it can have a mix of cool and warm colors. I

Re: [Matplotlib-users] [matplotlib-devel] RFC: candidates for a new default colormap

2015-06-05 Thread Joe Kington
Not to plug one of my own answers to much, but here's a basic example. http://stackoverflow.com/questions/20144529/shifted-colorbar-matplotlib I've been meeting to submit a PR with a more full featured version for a few years now, but haven't. On Jun 5, 2015 4:45 PM, Sourish Basu

Re: [Matplotlib-users] Confused about rgb_to_hsv and hsv_to_rgb

2015-05-22 Thread Joe Kington
I think you're asking how to blend a custom intensity image with an rgb image. (I'm traveling and just have my phone, so you'll have to excuse my lack of examples.) There are several ways to do this. Basically, it's analogous to blend modes in Photoshop etc. Have a look at the

Re: [Matplotlib-users] [matplotlib-devel] License, freetype

2017-02-17 Thread Joe Kington
Well, if Freetype were only distributed under the GPL, you couldn't distribute matplotlib in binary form without providing the source code. However, Freetype is distributed under more than one license. (see: https://www.freetype.org/license.html ) Because it's distributed under a BSD-style