[Matplotlib-users] Inconsistent Saving of Figures With Hatching

2012-04-13 Thread Patrick Marsh
Greetings,

I've noticed an issue when trying to create hatched plots. When I try
to create hatched plots with dashed lines, I get inconsistent behavior
between matplotlib.pyplot.show() and matplotlib.pyplot.savefig(). The
show() command will correctly (in terms of what I want) display the
hatched area as a dashed line, whereas savefig() will save an image
with the edge contour dashed, but the hatching as solid lines.

A self contained example script can be found here:
https://gist.github.com/2378109

For those who just want to see figures as to what I'm talking about
they can be found at the following.
What I want: http://www.patricktmarsh.com/tmp/correct_example.png
What I get: http://www.patricktmarsh.com/tmp/incorrect_example.png

What I want: http://www.patricktmarsh.com/tmp/correct_web.png
What I get: 
http://www.patricktmarsh.com/wp-content/gallery/2012images/20060406_day2_color.png


Thanks for any help!
Patrick
---
Patrick Marsh
Ph.D. Candidate / Liaison to the HWT
School of Meteorology / University of Oklahoma
Cooperative Institute for Mesoscale Meteorological Studies
National Severe Storms Laboratory
http://www.patricktmarsh.com

--
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Centering Text with axes_divider

2012-03-10 Thread Patrick Marsh
Hi, JJ,

I wonder why the simple text command does not work for you? e.g.,

 def add_center_text(ax):
ax.text(0.5, 0.9075, Centered Title, ha='center', va='center',
 fontsize=18,
bbox=dict(boxstyle='round, pad=0.5, rounding_size=0.25',
 fc=white,
  ec=k, lw=2),
transform=ax.transAxes)


The simple answer here is that I didn't understand what the transform
keyword argument was doing. I'm not entirely sure, still, but I gather it
has something to do with handling the changing of the axes coordinates.
 Man, I still have so much to learn about MPL


Also, annotate command gives you more flexibility in text positioning.

 The axes location is supposed to be known during the drawing time. To
 get the axes position, you may do  something like

   ax1._axes_locator(ax1, fig._cachedRenderer)

 Of course, this need to be done after the figure is properly drawn
 (e.g., after calling draw()) or during the drawing time.


Excellent. Thank you fot taking the time to explain how this works.
Although your first suggestion is what I need for the moment, I'm glad to
know how to get the axes positions, should I ever need them.


Thanks again!


Patrick
--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Centering Text with axes_divider

2012-03-09 Thread Patrick Marsh
Hi, All,

Here's an update to the problem I submitted last night.

I was able to utilize anchored text to work for centering a title, which is
ultimately what I'm wanting to do now. (Although, I'd still like to know
the proper way to get the axes bounds when using axes_divider).  The new
problem lies how to horizontally align the text inside the anchored box.
When the horizontal alignment is left, the text lines up in the anchored
box. However, as the updated example below shows, then you use center or
right, the text is now positioned outside the anchored box.  Is this a
bug in how the text is aligned? If so, how might I go about tracking it
down?


https://gist.github.com/2004869 (rev: b984ca)


Cheers,
Patrick
---
Patrick Marsh
Ph.D. Student / Liaison to the HWT
School of Meteorology / University of Oklahoma
Cooperative Institute for Mesoscale Meteorological Studies
National Severe Storms Laboratory
http://www.patricktmarsh.com



On Fri, Mar 9, 2012 at 12:12 AM, Patrick Marsh patrickmars...@gmail.comwrote:

 Greetings,

 Let me begin by saying that I've fallen in love with ImageGrid. I love the
 control it gives me in setting up plots, and I really like the control it
 offers for setting up a colorbar. Unfortunately, like all relationships,
 ImageGrid and I have hit a rough patch.

 I like to manually place titles and other boxes of texts on plots that I
 make using ImageGrid. However, to center things I have to know what the
 axes bounds are so I can do the centering calculations. Unfortunately, when
 using ImageGrid, or axes_divider, I have yet to find a way to get the axes
 bounds that are actually used to do the plotting. When I try to use

 ax.get_position().bounds

 I get the pre-adjusted bounds, even if I use plt.draw() before requesting
 the axes_positions. This means the only way I can center the text is by
 guessing what the final axes bounds will be.  Is there any way of getting
 the final bounds? It appears anchored text is able to do it, but I haven't
 been able to...


 Here's a self-contained example script that demonstrates the problem.  I
 don't use ImageGrid, instead using axes_divider, however this is the same
 problem that AxesGrid has. (I'm guessing this is because ImageGrid
 ultimately does what I did here behind the scenes.)

 https://gist.github.com/2004869


 Thanks for any help!


 Patrick
 ---
 Patrick Marsh
 Ph.D. Student / Liaison to the HWT
 School of Meteorology / University of Oklahoma
 Cooperative Institute for Mesoscale Meteorological Studies
 National Severe Storms Laboratory
 http://www.patricktmarsh.com



--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Centering Text with axes_divider

2012-03-08 Thread Patrick Marsh
Greetings,

Let me begin by saying that I've fallen in love with ImageGrid. I love the
control it gives me in setting up plots, and I really like the control it
offers for setting up a colorbar. Unfortunately, like all relationships,
ImageGrid and I have hit a rough patch.

I like to manually place titles and other boxes of texts on plots that I
make using ImageGrid. However, to center things I have to know what the
axes bounds are so I can do the centering calculations. Unfortunately, when
using ImageGrid, or axes_divider, I have yet to find a way to get the axes
bounds that are actually used to do the plotting. When I try to use

ax.get_position().bounds

I get the pre-adjusted bounds, even if I use plt.draw() before requesting
the axes_positions. This means the only way I can center the text is by
guessing what the final axes bounds will be.  Is there any way of getting
the final bounds? It appears anchored text is able to do it, but I haven't
been able to...


Here's a self-contained example script that demonstrates the problem.  I
don't use ImageGrid, instead using axes_divider, however this is the same
problem that AxesGrid has. (I'm guessing this is because ImageGrid
ultimately does what I did here behind the scenes.)

https://gist.github.com/2004869


Thanks for any help!


Patrick
---
Patrick Marsh
Ph.D. Student / Liaison to the HWT
School of Meteorology / University of Oklahoma
Cooperative Institute for Mesoscale Meteorological Studies
National Severe Storms Laboratory
http://www.patricktmarsh.com
--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How matplotlib got me a job

2012-02-07 Thread Patrick Marsh
Congratulations, Ben! That's an awesome story!


I am by no means at the level of competence that Ben (or Ryan May,
another matplotlib contributor and meteorology PhD student at OU) but
have been able to turn what I've learned from lurking on the MPL
listserv (as well as the Numpy/Scipy listservs) into an improved lot
in life.  By no means is it a permanent job, but based on what I've
learned from everyone here, I was able to land what amounts to a
Post-Doc position with the National Severe Storms Laboratory, while I
work toward finishing my PhD. It's so much so that I spend more of my
time actually helping solve other's MPL/Numpy/Scipy problems than I do
working on my own stuff! I'll admit there are times where I think to
myself I should be more selfish and focus on finishing my degree, but
I believe that I owe it to the community to give back, even if it is
off-list. My knowledge is a product of your knowledge and thus I
believe I'm obligated to share it with those around me who lack it,
but desperately need it.

I have to admit, when I first came to the world of Python (from Java
and C), I was amazed at the tools readily available --- the
matplotlib, numpy, and scipys of the community. Specific to MPL, I
thought it was the greatest thing ever. I did all of my plotting with
it.  However, as I got into more advanced Python programming and
needed more complex examples, I became frustrated and discouraged that
I couldn't do exactly what I wanted. So much so, that I temporarily
switched to R and the use of the ggplot2 package. However, as I
continued to advance I learned the beauty of matplotlib and realized
just how powerful it actually was. I began to see how to do all the
things I couldn't do before. It's powerful enough that I'm forcing
those around me to switch to Python and MPL, not because I'm telling
them they have to, but because they see what I'm doing with it and
realize that in order to keep up, they need to make the switch.

As I continue to mature as a Python person, I want to give back
explicitly to the community that's given so much to me. The problem
is, I don't know how. I'm intimidated by the awesomeness of what I see
being done around me that I don't even know where to begin. How does
one even begin to learn how to understand the deep intricacies of MPL,
Numpy, and Scipy so that I'd begin to develop a comfort level that
would allow me to begin to actively contribute? I know pretty much
everyone on these listservs, including myself, is busy. (I'm in the
midst of a 30-day PhD General Exam, and probably shouldn't even be
reading the listservs and/or typing this email! *wink*) But if there
are those out there that are willing to take a little time and invest
in me, and I'm sure there are others like me, I'd gladly become an
active contributor instead of a lurker.

Anyways, I know this email is a tad on the long side, and a little off
the original topic, so if you're still reading, thanks! This is
something that's been weighing on me for a few months now, and I
thought Ben's exultation of the benefits of the community might be a
good time to open up.


Cheers,
Patrick
---
Patrick Marsh
Ph.D. Student / Liaison to the HWT
School of Meteorology / University of Oklahoma
Cooperative Institute for Mesoscale Meteorological Studies
National Severe Storms Laboratory
http://www.patricktmarsh.com



On Tue, Feb 7, 2012 at 11:19 AM, Fernando Perez fperez@gmail.com wrote:
 On Tue, Feb 7, 2012 at 9:02 AM, Ethan Gutmann ethan.gutm...@gmail.com wrote:

 Also, congrats Ben, both on finishing the PhD and on the job. If you ever 
 find yourself in Boulder, CO (I'm at NCAR), let me know and I'll buy you a 
 drink.

 Indeed, congrats to Ben!  And I'm very glad to see your many
 contributions to the project finding acknowledgment and long-term
 benefits for you.

 BTW Ethan, it's been a few years since the last time that John  Hunter
 and I lectured at NCAR (Dec. 2007), but in early April Min
 Ragan-Kelley and I will be teaching at a workshop at CU, focusing on
 data analysis with the 'scipy stack' and ipython's parallel machinery.
  This will be in the context of a genomics workshop on campus, but if
 you are interested we might be able to meet up with some of the python
 crowd at NCAR...

 Just let me know if you are interested; best to write to
 fernando.pe...@berkeley.edu, as I sometimes stop monitoring mailing
 lists if I get swamped.

 Cheers,

 f

 --
 Keep Your Developer Skills Current with LearnDevNow!
 The most comprehensive online learning library for Microsoft developers
 is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
 Metro Style Apps, more. Free future releases when you subscribe now!
 http://p.sf.net/sfu/learndevnow-d2d
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib

Re: [Matplotlib-users] Plotting basemap on top of other data

2011-12-10 Thread Patrick Marsh
HI,

My initial thought was that you need to use the zorder keyword
argument and set the zorder to a large value.  However, the more I
thought about it, I'm not really sure how you are plotting the
satellite data.  Can you provide a code snippet?

PTM
---
Patrick Marsh
Ph.D. Student / Liaison to the HWT
School of Meteorology / University of Oklahoma
Cooperative Institute for Mesoscale Meteorological Studies
National Severe Storms Laboratory
http://www.patricktmarsh.com



On Fri, Dec 9, 2011 at 6:58 AM, Laat de, Jos (KNMI) jos.de.l...@knmi.nl wrote:
 I am working with (geostationary) satellite data, and one of the things I
 want to do is plot a map (coastlines) on top of the satellite image. As an
 IDL user I know how to do this in IDL (although in IDL it is a bit of a
 hassle), but I don’t seem to be able to figure out how this could be done in
 python.



 The satellite data consists of a rectangular field of N by N pixels. The
 data is already converted to bitmap RGB values. I have figured out how this
 can be written to a bitmap image like PNG or JPG.



 I further figured out how to do the satellite projection in Basemap, and how
 to plot Basemap coastlines. However, the Basemap appears to have a
 non-transparent background, which overplots all bitmap data if I plot the
 Bitmap data first. I had hoped that there would be some transparency setting
 in Basemap, but alas.



 (ps. Keep in mind that I do not want to use some contour filling routine for
 plotting the satellite data. I want to retain the original N x N pixels and
 image size)


 --
 Cloud Services Checklist: Pricing and Packaging Optimization
 This white paper is intended to serve as a reference, checklist and point of
 discussion for anyone considering optimizing the pricing and packaging model
 of a cloud services business. Read Now!
 http://www.accelacomm.com/jaw/sfnl/114/51491232/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Removing Markers from Figure

2011-05-27 Thread Patrick Marsh
Greetings,

I'm needing to create two plots, one is to serve as an overlay on the
other.  The overlay contains a set of markers to identify points in
the underlaid probability field.  I'm doing this in a loop with a map
background, so to prevent redrawing the map every time, I want to
remove the markers after saving the plot (so I can then reuse the
background again).  I know how to remove contours, but cannot figure
out how to remove points.  Here is a link to a sample script that
illustrates the problem.

https://gist.github.com/072c8612f313e8ea2355

Ideally, I would expect each plot to have only a single point, but the
old points aren't being removed and are displayed on subsequent
images.  What am I doing wrong?


Patrick
---
Patrick Marsh
Ph.D. Student / Liaison to the HWT
School of Meteorology / University of Oklahoma
Cooperative Institute for Mesoscale Meteorological Studies
National Severe Storms Laboratory
http://www.patricktmarsh.com

--
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Removing Markers from Figure

2011-05-27 Thread Patrick Marsh
Thanks, Eric!

I had tried

pt = plot(...)

for p in pt:
  p.remove()

and that did not do the trick.  However, doing it the way you
suggested worked like a charm.  Thanks!


Patrick
---
Patrick Marsh
Ph.D. Student / Liaison to the HWT
School of Meteorology / University of Oklahoma
Cooperative Institute for Mesoscale Meteorological Studies
National Severe Storms Laboratory
http://www.patricktmarsh.com




On Fri, May 27, 2011 at 2:57 PM, Eric Firing efir...@hawaii.edu wrote:
 On 05/27/2011 07:53 AM, Patrick Marsh wrote:
 Greetings,

 I'm needing to create two plots, one is to serve as an overlay on the
 other.  The overlay contains a set of markers to identify points in
 the underlaid probability field.  I'm doing this in a loop with a map
 background, so to prevent redrawing the map every time, I want to
 remove the markers after saving the plot (so I can then reuse the
 background again).  I know how to remove contours, but cannot figure
 out how to remove points.  Here is a link to a sample script that
 illustrates the problem.

 https://gist.github.com/072c8612f313e8ea2355

 Ideally, I would expect each plot to have only a single point, but the
 old points aren't being removed and are displayed on subsequent
 images.  What am I doing wrong?

 Illustration with ipython -pylab:

 In [1]: xx = plot(1.3, 2.4, 'ro')

 In [2]: xx[0].remove()

 In [3]: draw()

 Note that plot() returns a list of Line2D objects, each of which has a
 remove() method.

 Eric


 --
 vRanger cuts backup time in half-while increasing security.
 With the market-leading solution for virtual backup and recovery,
 you get blazing-fast, flexible, and affordable data protection.
 Download your free trial now.
 http://p.sf.net/sfu/quest-d2dcopy1
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Create axes instance position relative to another axes instance position??

2009-08-23 Thread Patrick Marsh
Hi JJ,

I'm not sure I understand how to properly set the axe_locator.  Below
is my snippet of code that I use to create my contourf plot and then
create the colorbar.  I'm unsure how I would modify it to do as you
suggested.  Any help would be appreciated.

plot = ax.contourf(xc, yc, data, cmap=cmap, levels=clevels)
cax = plt.axes([0.85, 0.125, 0.035, 0.325])
cbar = fig.colorbar(plot, format='%.1f', cax=cax)

I should also point out that the reason I'm not using the axes_grid
toolkit is because I'm constrained to develop based on the current
Enthought release.

Patrick
---
Patrick Marsh
Graduate Research Assistant
School of Meteorology
University of Oklahoma
http://www.patricktmarsh.com




On Sat, Aug 22, 2009 at 10:37 PM, Jae-Joon Leelee.j.j...@gmail.com wrote:
 What you need is to adjust the axes position of the colorbar at the
 drawing time (because the axes position of the contour plot is
 adjusted only during the drawing time).
 You may do this by properly setting the axe_locator property of the axes.

 If you're using mpl 0.99, axes_grid toolkit may be helpful.
 I just posted a simple example with the screenshot in the link below.

 http://abitofpythonabitofastronomy.blogspot.com/2009/08/creating-color-bar-using-inset-axes.html

 Regards,

 -JJ



 On Sat, Aug 22, 2009 at 9:51 PM, Patrick Marshpatrickmars...@gmail.com 
 wrote:
 Greeting MPL world,

 I have a contourf plot where the aspect ratio is 1.  I need to add a
 colorbar to the plot in a manner that keeps the colorbar in the same
 place relative to the contourf plot (good.png), even if the parent
 window is resized.  I can do this with text, but haven't been able to
 figure out how to do it with a colorbar.  To the best of my knowledge,
 there are two ways forward.

 1.)  I can create an entirely new axis instance (cax) but will need to
 find a way to define the axes in a relative way to the original ax
 instance.  As it stands now, I can only define axes in terms of the
 total figure size.  As a result, the figure looks like it does in
 bad.png


 2.)  I can use the original ax instance, but need to find a way to
 have more control over the colorbar placement.  For example, it needs
 to sit on the x-axis and not be centered in the middle of the yaxis.
  Using shrink and aspect, I can get the plot size to be correct,
 however it's position is centered on the yaxis as in bad2.png

 Is there a way to accomplish what I'm needing to do and I'm just missing it?

 Thanks in advance,
 Patrick
 ---
 Patrick MarshC
 Graduate Research Assistant
 School of Meteorology
 University of OklahomaC
 http://www.patricktmarsh.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




--
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] Installing matplotlib for Python 2.6 on windows

2009-02-24 Thread Patrick Marsh
As I mentioned in a previous email last night, I have built an
installer for matplotlib (updated this afternoon) off the SVN trunk.
You are welcome to use it, however be aware that maplotlib does not
support Python 2.6 (and won't until after Numpy officially supports
Python 2.6) and there are some known issues - one of which is that I
can't get Tkinter to work properly when using plot.show().  As a work
around I strongly suggest installing WxPython and using that as the
default backend.  If you do chose to use this installer please know
that it is unsupported and you are on your own if something breaks.

http://code.patricktmarsh.com/builds

-Patrick



On Tue, Feb 24, 2009 at 7:22 PM, Philip Bloom pbl...@crystald.com wrote:
 What is the recommended way to install matplotlib for python 2.6?

 I have numpy installed currently on my python 2.6 distribution.  Is there an
 existing binary installer for matplotlib?  Is the best thing to do to try
 and compile from the current .98.5 source?

 Thanks for any help or advice, it is much appreciated.

 --
 Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
 -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
 -Strategies to boost innovation and cut costs with open source participation
 -Receive a $600 discount off the registration fee with the source code: SFAD
 http://p.sf.net/sfu/XcvMzF8H
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users





-- 
Patrick Marsh
Graduate Research Assistant
School of Meteorology
University of Oklahoma
http://www.patricktmarsh.com

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Python 2.6 installer for Windows?

2009-02-23 Thread Patrick Marsh
I have built matplotlib (and numpy since it is required for
matplotlib) with python2.6.  Please note that these are UNSUPPORTED
and you use them at your own risk.  They were built from the 9
February 2009 SVN so use at your own risk.  You will have to install
numpy first and matplotlib second.  I would also recommend installing
WxPython before installing matplotlib since there are some bugs using
Tkinter with matplotlib on python2.6.  I've been too busy to try and
track it down.

http://code.patricktmarsh.com/builds/

-Patrick




On Sun, Feb 22, 2009 at 4:59 PM, Wai Yip Tung tungwai...@yahoo.com wrote:
 Hello all,

 I find that Matplotlib only have Python 2.5 build for Windows. Is there
 any plan to release a 2.6 build soon? I am trying to build it from source
 but I run into numerous problem. I am still struggling to find all
 dependent packages. It will help a lot if the 2.6 installer is available.

 Thanks,

 Wai Yip


 --
 Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
 -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
 -Strategies to boost innovation and cut costs with open source participation
 -Receive a $600 discount off the registration fee with the source code: SFAD
 http://p.sf.net/sfu/XcvMzF8H
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




-- 
Patrick Marsh
Graduate Research Assistant
School of Meteorology
University of Oklahoma
http://www.patricktmarsh.com

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] building from source on Windows

2009-01-27 Thread Patrick Marsh
I figured out why your show() works...you had WxPython installed and
I'm assuming your backend was defaulting to this since Tkinter wasn't
found.  Once I noticed that I installed WxPython and then re-buily
matplotlib with WxPython.  If I used wxpython as my backend, then my
GUIs worked.  I can import pylab just fine and I don't appear to have
any errors.  While I can't figure out what your problem is, you are
free to try the binary I built and see if it works:
http://code.patricktmarsh.com/matplotlib-0.98.6svn.win32-py2.6.exe

If you do decide to try this, let me know if it works.

-Patrick





On Tue, Jan 27, 2009 at 9:22 AM, Marcin Krol mrk...@gmail.com wrote:
 John Hunter wrote:

 First of all, on the clean build, when you do

   import matplotlib._path

 do you still get the same error.

 No, it's working fine on the new build (the import above and the whole
 installation0 -- once I switched to VC++ from MinGW.

 snip info, ack

 Regards,
 mk

 --
 This SF.net email is sponsored by:
 SourcForge Community
 SourceForge wants to tell your story.
 http://p.sf.net/sfu/sf-spreadtheword
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




-- 
Patrick Marsh
Graduate Research Assistant
School of Meteorology
University of Oklahoma
http://www.patricktmarsh.com

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] contour coordinates

2009-01-27 Thread Patrick Marsh
On Tue, Jan 27, 2009 at 5:33 PM, Jeff Whitaker jsw...@fastmail.fm wrote:
 Eli Brosh wrote:
 Hello,
 I am trying to extract the coordinates of contour lines.
 I tried the following:

 cs = *contour*(Z)
 for lev, col in zip(cs.levels, cs.collections):
  s = col._segments

 that I found in a previous post (title contouring, by Jose
 Gómez-Dans-2 http://www.nabble.com/user/UserProfile.jtp?user=30071
 Nov 30, 2007; 07:47am ) .

 I hoped that s will be a list of numpy arrays, each containing the
 (x,y) vertices
 defining a contour line at level lev.
 However, I got an error message:
 AttributeError: 'LineCollection' object has no attribute '_segments'


 How is it possible to get coordinates of the contours, similar to the
 MATLAB command
  [C,H] = *CONTOUR*(...)
 where the result in C is the coordinates of the contours.

 A similar question appeared in a post contour data (by Albert Swart
 http://www.nabble.com/user/UserProfile.jtp?user=382945 May 17, 2006;
 09:42am) but I could not understand the answer.
 Is it possible to get more specific directions with a simple example ?


 Thanks
 Eli
 Eli:  Calling get_paths() on each line collection in CS.collections will
 return a list of Path objects.  From the Path objects, you can get a Nx2
 array of vertices from the vertices attribute.  There are no examples
 that I know of, but if you get it to do what you want to do, it would be
 great if you could contribute an example.  As you noted, this question
 has come up several times before.

 -Jeff

 --
 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



 --
 This SF.net email is sponsored by:
 SourcForge Community
 SourceForge wants to tell your story.
 http://p.sf.net/sfu/sf-spreadtheword
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


I'm not sure if this is entirely what you (Eli) are looking for, but I
have code that will contour model data on a map and then extract the
lat,lon pairs of all the vertices.  If this is what you are looking
for, I'm happy to share what I've done.

-Patrick

-- 
Patrick Marsh
Graduate Research Assistant
School of Meteorology
University of Oklahoma
http://www.patricktmarsh.com

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] contour coordinates

2009-01-27 Thread Patrick Marsh
On Tue, Jan 27, 2009 at 7:16 PM, Eli Brosh ebro...@gmail.com wrote:
 Many thanks to Jeff and to Patric !
 I will try to work along the line suggested by Jeff.
 Patric, please send me your code.
 I hope to learn from it.

 Thanks again,
 Eli


Here is a template that can be used.  I use this for meteorological
models, but should work with any gridded file.


import numpy as np
from mpl_toolkits.basemap import Basemap

f = (some gridded file)
X = np.array(grab longitudes from f)
Y = np.array(grab latitudes from f)
field = np.array(grab field to be contoured from f)
map = Basemap(make a Basemap call here)
level = np.arange(minval, maxval, interval)
col   = map.contour(X, Y, field, level).collections

for vertex in col[i].get_paths():# GET THE PATHS FOR THE EACH
CONTOUR BY LOOPING THROUGH CONTOURS
for vertex in xy.vertices:  # ITERATE OVER THE PATH OBJECTS
x, y = map(vertex[0],vertex[1],inverse=True)   # vertex[0]
and now 'x' is the longitude of the vertex and vertex[1] and now 'y'
is the latitude of the vertex


Let me know how this works.

-Patrick










 On Tue, Jan 27, 2009 at 7:09 PM, Patrick Marsh patrickmars...@gmail.com
 wrote:

 On Tue, Jan 27, 2009 at 5:33 PM, Jeff Whitaker jsw...@fastmail.fm wrote:
  Eli Brosh wrote:
  Hello,
  I am trying to extract the coordinates of contour lines.
  I tried the following:
 
  cs = *contour*(Z)
  for lev, col in zip(cs.levels, cs.collections):
   s = col._segments
 
  that I found in a previous post (title contouring, by Jose
  Gómez-Dans-2 http://www.nabble.com/user/UserProfile.jtp?user=30071
  Nov 30, 2007; 07:47am ) .
 
  I hoped that s will be a list of numpy arrays, each containing the
  (x,y) vertices
  defining a contour line at level lev.
  However, I got an error message:
  AttributeError: 'LineCollection' object has no attribute '_segments'
 
 
  How is it possible to get coordinates of the contours, similar to the
  MATLAB command
   [C,H] = *CONTOUR*(...)
  where the result in C is the coordinates of the contours.
 
  A similar question appeared in a post contour data (by Albert Swart
  http://www.nabble.com/user/UserProfile.jtp?user=382945 May 17, 2006;
  09:42am) but I could not understand the answer.
  Is it possible to get more specific directions with a simple example ?
 
 
  Thanks
  Eli
  Eli:  Calling get_paths() on each line collection in CS.collections will
  return a list of Path objects.  From the Path objects, you can get a Nx2
  array of vertices from the vertices attribute.  There are no examples
  that I know of, but if you get it to do what you want to do, it would be
  great if you could contribute an example.  As you noted, this question
  has come up several times before.
 
  -Jeff
 
  --
  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
 
 
 
 
  --
  This SF.net email is sponsored by:
  SourcForge Community
  SourceForge wants to tell your story.
  http://p.sf.net/sfu/sf-spreadtheword
  ___
  Matplotlib-users mailing list
  Matplotlib-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 

 I'm not sure if this is entirely what you (Eli) are looking for, but I
 have code that will contour model data on a map and then extract the
 lat,lon pairs of all the vertices.  If this is what you are looking
 for, I'm happy to share what I've done.

 -Patrick

 --
 Patrick Marsh
 Graduate Research Assistant
 School of Meteorology
 University of Oklahoma
 http://www.patricktmarsh.com





-- 
Patrick Marsh
Graduate Research Assistant
School of Meteorology
University of Oklahoma
http://www.patricktmarsh.com

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] building from source on Windows

2009-01-26 Thread Patrick Marsh
Greetings,

Did you download the win32_static folder and place it in the top level
of the matplotlic source?

I had similar problems building on my windows machine until I did this
and now it works fine.  You might also check all the README documents,
as one of them gives you more information about building for windows.


-Patrick



On Mon, Jan 26, 2009 at 8:17 AM, Marcin Krol mrk...@gmail.com wrote:
 Hello everyone,

 I'm trying to get 0.98.5.2 installed on Windows to use Python 2.6
 (dependency packages I need to use on that version, long story, etc).

 When I was trying to build it (python setup.py build), it was finding
 the VC 9.0 C++ compiler on my comp. However, after adding necessary
 packages (zlib, png, etc), it was reporting missing 'unistd.h'. Clearly,
 this means it was meant to be built with GCC for Windows like MinGW ?

 I have uninstalled the VC compiler, installed GnuWin32 packages and
 tried using MinGW (passing --compiler=mingw32 to python setup.py build )
 but now compilation process fails like this:

 c:\MinGW\bin\g++.exe -mno-cygwin -shared -s
 build\temp.win32-2.6\Release\src\ft2font.o build\temp.wi
 n32-2.6\Release\src\mplutils.o
 build\temp.win32-2.6\Release\cxx\cxxsupport.o build\temp.win32-2.6\Re
 lease\cxx\cxx_extensions.o
 build\temp.win32-2.6\Release\cxx\indirectpythoninterface.o build\temp.win
 32-2.6\Release\cxx\cxxextensions.o
 build\temp.win32-2.6\Release\src\ft2font.def -LC:\Python26\libs -
 LC:\Python26\PCbuild -lfreetype -lz -lgw32c -lstdc++ -lm -lpython26
 -lmsvcr90 -o build\lib.win32-2.6
 \matplotlib\ft2font.pyd
 c:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe:
 cannot find -lgw32c
 collect2: ld returned 1 exit status
 error: command 'g++' failed with exit status 1

 What the heck is lgw32c??

 Regards,
 mk

 --
 This SF.net email is sponsored by:
 SourcForge Community
 SourceForge wants to tell your story.
 http://p.sf.net/sfu/sf-spreadtheword
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




-- 
Patrick Marsh
Graduate Research Assistant
School of Meteorology
University of Oklahoma
http://www.patricktmarsh.com

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] building from source on Windows

2009-01-26 Thread Patrick Marsh
Hi Marcin,

I didn't catch on the first email you were trying to build for
python2.6.  I haven't been able to get matplotlib to build correctly
with python2.6.  I'm actually curious as to how you were able to build
matplotlib using the win32_static folder since it doesn't contain the
libs and header files for tcl/tk 8.5 which python2.6 is build against.
 This was the original error for me and I had to modify the
setupext.py to look for the tcl/tk 8.5 includes (which I had to
manually add to win32_static).  What happens if you try:

import matplotlib.pyplot as plt
x = range(0,100)
y = range(0,100)
plt.plot(x,y)
plt.show()


As for the error you specifically mentioned, have you checked to make
sure that the correct dll exists?  This error typically happens to me
when the dll didn't build properly (if at all).


-- 
Patrick Marsh
Graduate Research Assistant
School of Meteorology
University of Oklahoma
http://www.patricktmarsh.com

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] csv2rec column names

2009-01-03 Thread Patrick Marsh
I'm not sure what you are needing it for, but I would suggest looking
into numpy's loadtxt function.  You can use this to load the csv data
into numpy arrays and pass the resulting arrays arround.

-Patrick






On Sat, Jan 3, 2009 at 11:21 AM, antonv vasilescu_an...@yahoo.com wrote:

 Hi all,

 I have a lot of csv files to process, all of them with the same number of
 columns. The only issue is that each file has a unique column name for the
 fourth column.

 All the csv2rec examples I found are using the r.column_name format to
 access the data in that column which is of no use for me because of the
 unique names. Is there a way to access that data using the column number? I
 bet this should be something simple but I cannot figure it out...

 Thanks in advance,
 Anton
 --
 View this message in context: 
 http://www.nabble.com/csv2rec-column-names-tp21267055p21267055.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] csv2rec column names

2009-01-03 Thread Patrick Marsh
In my limited opinion, numpy's loadtxt is the way to go.  Loadtxt
doesn't care about the headerYou can read in the arrays like this:

# read in all 5 columns as text
col1, col2, col3, col4, col5 = np.loadtxt(filename, dtype=dtype, unpack=True)

or if you want to skip the column headings and read in just a specific
data type of just the last column

# read in only column 5, as a specific dtype, and exclude the column 5 heading
col5_no_header = np.loadtxt(filename, skiprows=1, usecols=(5),
dtype=dtype, unpack=True)


-Patrick






On Sat, Jan 3, 2009 at 11:39 AM, antonv vasilescu_an...@yahoo.com wrote:

 I am plotting the data in those csv files and the forst 4 columns in the
 files have the same title but the 5th has the name based on the date and
 time so it would be unique in each of the files. As I have about 600 files
 to batch process, adjusting my script manually is not an option.

 The way I have it for one test file is:

 r = mlab.csv2rec('test.csv')
 #i know that the column name for the 5th column is 'htsgw_12191800'
 #so to read the data in the 5th column i just use:
 z = r.htsgw_12191800

 What i need is to be able to get that data by specifying the column number
 as that stays the same in all files.

 I'll look at numpy but I hope there is a simpler way.

 Thanks,
 Anton



 Patrick Marsh-2 wrote:

 I'm not sure what you are needing it for, but I would suggest looking
 into numpy's loadtxt function.  You can use this to load the csv data
 into numpy arrays and pass the resulting arrays arround.

 -Patrick






 On Sat, Jan 3, 2009 at 11:21 AM, antonv vasilescu_an...@yahoo.com wrote:

 Hi all,

 I have a lot of csv files to process, all of them with the same number of
 columns. The only issue is that each file has a unique column name for
 the
 fourth column.

 All the csv2rec examples I found are using the r.column_name format to
 access the data in that column which is of no use for me because of the
 unique names. Is there a way to access that data using the column number?
 I
 bet this should be something simple but I cannot figure it out...

 Thanks in advance,
 Anton
 --
 View this message in context:
 http://www.nabble.com/csv2rec-column-names-tp21267055p21267055.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



 --
 View this message in context: 
 http://www.nabble.com/csv2rec-column-names-tp21267055p21267232.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


[Matplotlib-users] Land-Sea masks (mpl_toolkits.basemap)

2008-11-07 Thread Patrick Marsh
Greetings,
I have global data that I would like to plot using mpl_toolkits.basemap.
 The catch is that I want to mask out all data over the ocean.  I know there
is a function to fill continents,map.fillcontinents(), but I can't seem to
find one for filling oceans.  Ideally, I want the oceans to show up with a
white background and no data contoured.

Am I completely missing something or is this functionality missing?

Thanks,

-- 
Patrick Marsh
Graduate Research Assistant
School of Meteorology
University of Oklahoma
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Grid Difficulties

2008-08-23 Thread Patrick Marsh
Greetings,

I'm having considerable difficulties in getting the axes grid to display
they way I would like it to.  Basically, I'm wanting to grid to be shown for
all of the x/y-ticks displayed, but only an irregular number show up.  What
I'm wanting to know is if my code is wrong or am I'm completely overlooking
something.  My code is below and an image can be found at
http://forwarn.org/images/USDIFFtest.png.

Also, I might as well ask...is there a way to manually specify the labels
that are displayed on the colorbar?  For instance, in the example below, my
values range from -5 to 4...how would I go about making sure the last 5 was
included in the colorbar?  I'll admit I haven't looked into this much as of
now since the first question was / is more pressing.

Thanks!

-Patrick Marsh



from __future__ import division
import numpy as np
import pylab as P
import copy


def open_text(REGION,FIELD):
#
#
#
  global DATAPATH1
  global DATAPATH2
  xaxis1,yaxis1,freq1 = np.loadtxt(DATAPATH1+'bin_CUR_%s_%s.txt' % (REGION,
FIELD), unpack=True)
  xaxis2,yaxis2,freq2 = np.loadtxt(DATAPATH2+'bin_FUT_%s_%s.txt' % (REGION,
FIELD), unpack=True)
  return(xaxis1,yaxis1,freq1,xaxis2,yaxis2,freq2)

if __name__ == '__main__':
#Main Program


  TIME   = 'CUR'
  REGION = 'PLAINS'
  FIELD  = 'CAPE-SHR6'

# PATHS TO THE INPUT (DATA) AND OUTPUT (IMAGES) DIRECTORIES
  DATAPATH1  = 'E:/RESEARCH/CCSM_OUTPUT/CURRENT/BIN/'
  DATAPATH2  = 'E:/RESEARCH/CCSM_OUTPUT/FUTURE/BIN/'
  IMAGEPATH = 'E:/RESEARCH/IMAGES/%s/%s/%s/' % (REGION, TIME, FIELD)

  xaxis1,yaxis1,freq1,xaxis2,yaxis2,freq2 = open_text(REGION, FIELD)

# TRANSFORM INTO THE CORRECT FORMAT
  xaxis1 = xaxis1.reshape(51,-1).T
  yaxis1 = yaxis1.reshape(51,-1).T
  freq1  = freq1.reshape(51,-1).T
  freq2  = freq1.reshape(51,-1).T

  freq1 = freq1 / (12 * 12 * 20)# (12*12*20 for PLAINS).(29*43*20
for EUR)
  freq2 = freq2 / (12 * 12 * 20)# (12*12*20 for PLAINS).(29*43*20
for EUR)

  diff  = freq1 - freq2

  xaxis = np.log10(xaxis1)
  yaxis = np.log10(yaxis1)
#  xaxis = xaxis1
#  yaxis = yaxis1

#  levs = np.arange(0,10,.1)
  levs = np.arange(-5,5,.1)
  xticks = [1,2,5,10,20,50,100,200,500,1000,2000,5000]
  yticks = [1,2,5,10,20,50,100]

  x = np.arange(1,1,1)

  P.figure(figsize=(8,8))
  CS = P.contourf(xaxis,yaxis,diff,levs)
  P.xlabel('\nCAPE')
  P.ylabel('0-6 km Shear')
  P.xlim(0,3)
  P.ylim(0,2)
  P.xticks(np.log10(xticks),xticks,)
  P.yticks(np.log10(yticks),yticks,)
  P.plot(np.log10(x),(np.log10(1/x)),color='black', linewidth=2)
  P.colorbar(drawedges=False, orientation='horizontal')
  P.grid(True)
  P.gca().xaxis.grid(True, which='minor',xdata=xticks,ydata=yticks)
  P.title('Difference\nCentral U.S. Normalized Frequency Distribution')
  P.savefig('USDIFFtest.png',dpi = 200)
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Grid Difficulties

2008-08-23 Thread Patrick Marsh
*embarrassed*

Turns out I was looking at a compressed version of the image that didn't
have all the grid lines on.  Examining the full version the image looks
correct.  I apologize for asking what is not a really dumb question.

However, the second question about the colorbar is still puzzling.

-Patrick





On Sat, Aug 23, 2008 at 9:49 AM, Patrick Marsh 
[EMAIL PROTECTED] [EMAIL PROTECTED]wrote:

 Greetings,

 I'm having considerable difficulties in getting the axes grid to display
 they way I would like it to.  Basically, I'm wanting to grid to be shown for
 all of the x/y-ticks displayed, but only an irregular number show up.  What
 I'm wanting to know is if my code is wrong or am I'm completely overlooking
 something.  My code is below and an image can be found at
 http://forwarn.org/images/USDIFFtest.png.

 Also, I might as well ask...is there a way to manually specify the labels
 that are displayed on the colorbar?  For instance, in the example below, my
 values range from -5 to 4...how would I go about making sure the last 5 was
 included in the colorbar?  I'll admit I haven't looked into this much as of
 now since the first question was / is more pressing.

 Thanks!

 -Patrick Marsh



 from __future__ import division
 import numpy as np
 import pylab as P
 import copy


 def open_text(REGION,FIELD):
 #
 #
 #
   global DATAPATH1
   global DATAPATH2
   xaxis1,yaxis1,freq1 = np.loadtxt(DATAPATH1+'bin_CUR_%s_%s.txt' % (REGION,
 FIELD), unpack=True)
   xaxis2,yaxis2,freq2 = np.loadtxt(DATAPATH2+'bin_FUT_%s_%s.txt' % (REGION,
 FIELD), unpack=True)
   return(xaxis1,yaxis1,freq1,xaxis2,yaxis2,freq2)

 if __name__ == '__main__':
 #Main Program


   TIME   = 'CUR'
   REGION = 'PLAINS'
   FIELD  = 'CAPE-SHR6'

 # PATHS TO THE INPUT (DATA) AND OUTPUT (IMAGES) DIRECTORIES
   DATAPATH1  = 'E:/RESEARCH/CCSM_OUTPUT/CURRENT/BIN/'
   DATAPATH2  = 'E:/RESEARCH/CCSM_OUTPUT/FUTURE/BIN/'
   IMAGEPATH = 'E:/RESEARCH/IMAGES/%s/%s/%s/' % (REGION, TIME, FIELD)

   xaxis1,yaxis1,freq1,xaxis2,yaxis2,freq2 = open_text(REGION, FIELD)

 # TRANSFORM INTO THE CORRECT FORMAT
   xaxis1 = xaxis1.reshape(51,-1).T
   yaxis1 = yaxis1.reshape(51,-1).T
   freq1  = freq1.reshape(51,-1).T
   freq2  = freq1.reshape(51,-1).T

   freq1 = freq1 / (12 * 12 * 20)# (12*12*20 for PLAINS).(29*43*20
 for EUR)
   freq2 = freq2 / (12 * 12 * 20)# (12*12*20 for PLAINS).(29*43*20
 for EUR)

   diff  = freq1 - freq2

   xaxis = np.log10(xaxis1)
   yaxis = np.log10(yaxis1)
 #  xaxis = xaxis1
 #  yaxis = yaxis1

 #  levs = np.arange(0,10,.1)
   levs = np.arange(-5,5,.1)
   xticks = [1,2,5,10,20,50,100,200,500,1000,2000,5000]
   yticks = [1,2,5,10,20,50,100]

   x = np.arange(1,1,1)

   P.figure(figsize=(8,8))
   CS = P.contourf(xaxis,yaxis,diff,levs)
   P.xlabel('\nCAPE')
   P.ylabel('0-6 km Shear')
   P.xlim(0,3)
   P.ylim(0,2)
   P.xticks(np.log10(xticks),xticks,)
   P.yticks(np.log10(yticks),yticks,)
   P.plot(np.log10(x),(np.log10(1/x)),color='black', linewidth=2)
   P.colorbar(drawedges=False, orientation='horizontal')
   P.grid(True)
   P.gca().xaxis.grid(True, which='minor',xdata=xticks,ydata=yticks)
   P.title('Difference\nCentral U.S. Normalized Frequency Distribution')
   P.savefig('USDIFFtest.png',dpi = 200)

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Retrieve Coordinates from Contour

2008-08-02 Thread Patrick Marsh
Thanks for the quick reply.

I may not have been totally clear on what I'm trying to save (or I totally
misunderstood what you were trying to say - which is certainly possible).

I'm not wanting to save the lat, lon pairs from the map projection.  I'm
trying to save the lat, lon pairs of the contour.  Using my original
example, if I'm plotting winds every 5 m/s, I'm wanting to pull off the lat,
lon pairs for the 5 m/s contours.

I'll check out the website and see if I find anything there.

-Patrick



On Sat, Aug 2, 2008 at 6:13 PM, Jeff Whitaker [EMAIL PROTECTED] wrote:

 Patrick Marsh wrote:

 Hi Everyone,

 First email here...

 I am plotting meteorological data using matplotlib and basemap - and can
 do this just fine.  However, I would like to backout the coordinates being
 used for the contours that are plotted.

 For example, if I were to contour windspeed every 5 m/s and plot this
 (which I can do just fine), I would like to save a copy of the lat, lon
 pairs as a text file.  However, I cannot for the life of me figure out how
 to do this.  I have a feeling it is pretty simple and I'm just over looking
 something that can do this.  Any help would be appreciated.

 Thanks,

 -Patrick Marsh
 Graduate Student
 School of Meteorology
 University of Oklahoma


 Patrick:  contour and contourf return a ContourSet object.
 ContourSet.collections is a matplotlib LineCollection (for contour) or a
 PolyCollection (for contourf).  You can retrieve the x,y (map projection)
 coordinates from these, and transfer them back to lat/lon coordinates using
 the Basemap instance via

 lons,lats = map(x,y,inverse=True) # map is a Basemap instance.

 See http://matplotlib.sourceforge.net/doc/html/api/collections_api.htmlfor 
 more info on matplotlib collection objects.

 HTH,
 -Jeff

  

 -
 This SF.Net email is sponsored by the Moblin Your Move Developer's
 challenge
 Build the coolest Linux based applications with Moblin SDK  win great
 prizes
 Grand prize is a trip for two to an Open Source event anywhere in the
 world
 http://moblin-contest.org/redirect.php?banner_id=100url=/
 

 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




 --
 Jeffrey S. Whitaker Phone : (303)497-6313
 NOAA/OAR/CDC  R/PSD1FAX   : (303)497-6449
 325 BroadwayBoulder, CO, USA 80305-3328



-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Retrieve Coordinates from Contour

2008-08-02 Thread Patrick Marsh
Hi Jeff (and others):

Sorry for the misunderstanding.  After your second email the first makes
more sense.

However, I still cannot figure out how to extract the lat,lon pairs from the
LineCollection object.  Searching on the web and based on Scott's suggestion
from another email, I see that in the past you could use a get_vertex()
option.  However it appears to have been discontinued in mpl v 0.98.1.

I'm a relative newcomer to Python (less than 6 months) and even greener when
it comes to the inner workings of matplotlib.  I'm sure I'm going to kick
myself when this is figured out...

-Patrick


On Sat, Aug 2, 2008 at 7:33 PM, Jeff Whitaker [EMAIL PROTECTED] wrote:

 Patrick Marsh wrote:

 Thanks for the quick reply.

 I may not have been totally clear on what I'm trying to save (or I totally
 misunderstood what you were trying to say - which is certainly possible).

 I'm not wanting to save the lat, lon pairs from the map projection.  I'm
 trying to save the lat, lon pairs of the contour.  Using my original
 example, if I'm plotting winds every 5 m/s, I'm wanting to pull off the lat,
 lon pairs for the 5 m/s contours.


 Patrick:  I know - that's what I was trying to explain.  You can get the
 x,y coordinates of the *contours* from the collections attribute of the
 ContourSet object returned by contour.  Then you convert those x,y values
 back to lon,lat values using the Basemap instance.

 -Jeff


 I'll check out the website and see if I find anything there.

 -Patrick



On Sat, Aug 2, 2008 at 6:13 PM, Jeff Whitaker [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] wrote:

Patrick Marsh wrote:

Hi Everyone,

First email here...

I am plotting meteorological data using matplotlib and
basemap - and can do this just fine.  However, I would
like to backout the coordinates being used for the
contours that are plotted.

For example, if I were to contour windspeed every 5 m/s
and plot this (which I can do just fine), I would like to
save a copy of the lat, lon pairs as a text file.
 However, I cannot for the life of me figure out how to do
this.  I have a feeling it is pretty simple and I'm just
over looking something that can do this.  Any help would
be appreciated.

Thanks,

-Patrick Marsh
Graduate Student
School of Meteorology
University of Oklahoma


Patrick:  contour and contourf return a ContourSet object.
ContourSet.collections is a matplotlib LineCollection (for
contour) or a PolyCollection (for contourf).  You can retrieve
the x,y (map projection) coordinates from these, and transfer
them back to lat/lon coordinates using the Basemap instance via

lons,lats = map(x,y,inverse=True) # map is a Basemap instance.

See

 http://matplotlib.sourceforge.net/doc/html/api/collections_api.html
for more info on matplotlib collection objects.

HTH,
-Jeff


  


  -
This SF.Net email is sponsored by the Moblin Your Move
Developer's challenge
Build the coolest Linux based applications with Moblin SDK
 win great prizes
Grand prize is a trip for two to an Open Source event
anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
http://moblin-contest.org/redirect.php?banner_id=100url=/

  

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
mailto:Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC  R/PSD1FAX   : (303)497-6449
325 BroadwayBoulder, CO, USA 80305-3328





 --
 Jeffrey S. Whitaker Phone : (303)497-6313
 NOAA/OAR/CDC  R/PSD1FAX   : (303)497-6449
 325 BroadwayBoulder, CO, USA 80305-3328


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users