Re: [Matplotlib-users] Plotting MODIS data in Python / basemap - a MODIS workflow solution?

2009-10-27 Thread Jose Gomez-Dans
Hi,

> I asked him if he had a solution for plotting standard MODIS hdf products
> available here:
> http://rapidfire.sci.gsfc.nasa.gov/realtime/2009300/
>
> In more general terms, what are people using for a 'MODIS workflow'? I
> can't
> imagine I'm the first to want to plot MODIS images using basemap. Does
> anyone have a 'roadmap' (as Christian phrased it)? I am interested in the
> steps from A-Z. That is, what tool to read the hdf files (modis is hdf4),
> what tool to reproject the data, and finally, the basemap plotting.
>

Really, it's what you want to do with your MODIS data. My "workflow" is
usually as follows:
1.- Access MODIS data (and ancillary stuff, such as QA flags etc) using
Python's GDAL bindings.
2.- Manipulate the MODIS data from (1) using numpy, scipy. If there's
significant looping involved, use weave to speed things up.
3.- Plot using matplotlib. Usually, as imshow ("vanilla matplotlib"),
sometimes using basemap. The difference is whether I'm just quickly plotting
something together, or whether I want to actually have a map where I want to
plot other stuff on top of the MODIS data.

In terms of rapidfire, you can even access the WMS data using GDAL, so no
need to download the data. An example for monitoring El Niño related fires
in Borneo is attached. You need to get the fires in the last 7days file (we
download it as a crontab jobby), and the attached script just plots the data
on a basemap for quick visualisation.

I am in the process of putting most of my notes on <
http://sites.google.com/site/spatialpython/> and there's also the Unofficial
Python GIS SIG , another
useful resource.

Your particular example is plotting RGB composites derived from Level 1
data, it seems? As I said, if you tell us what you want to do with it, we
may be able to provide more information.

Cheers,

Jose
# -*- coding: utf-8 -*-
#Copyright: J Gomez-Dans 
#
#2009-10-27
#
#This code is licensed under the terms of the GNU General Public License (GPL),
#version 2 or above; See /usr/share/common-licenses/GPL , or see
#http://www.fsf.org/licensing/licenses/gpl.html

from osgeo import ogr
import pylab
from mpl_toolkits.basemap import Basemap

g = ogr.Open("SouthEast_Asia_7d.shp")
L = g.GetLayer(0)
x=[] ; y=[]
while True:
	feat = L.GetNextFeature()
	if not feat: break
	geom = feat.GetGeometryRef()
	x.append( geom.GetX()) ; y.append( geom.GetY())
m = Basemap( llcrnrlon=108, llcrnrlat=-5, urcrnrlon=120,urcrnrlat=8, projection='merc',\
			lat_ts=0.0,resolution='h')
m.bluemarble()
m.drawcoastlines (linewidth=0.25,color='w')
m.drawcountries(linewidth=0.25,color='w')
m.drawmeridians(pylab.arange(0,360,5))
m.drawparallels(pylab.arange(-90,90,5))
m.drawmapboundary()
(X,Y) = m( x, y )

m.plot ( X, Y , 'rs', ms=7.0, mew=0)
pylab.title("Fires in Borneo in the last 7 days")
pylab.savefig ("Borneo.png")
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plotting MODIS data in Python / basemap - a MODIS workflow solution?

2009-10-27 Thread Jose Gomez-Dans
Hi!

This is probably getting a bit off-topic now, maybe better keep this
converation going on python-gis-sig list? I'm cc'ing there

2009/10/27 John [H2O] 

> What I want to do is quite simple (I think). I simply would like to be able
> to:
>
> 1) Download any resolution of the hdf files available via :
> http://rapidfire.sci.gsfc.nasa.gov/realtime/2009XXX/  where XXX is day of
> year.
>
Basically you have the MOD021K, MOD02HK and MOD02QK data granules, plus the
MOD03 data granule. The former are the 1k, 500m and 250m data (hence the
name) and the latter is a collection of geolocation terms (imaging
geometries, etc).

You realise that these are swath data don't you? So they have no direct
information on the location of each pixel, although you can work it out from
the sensor height, attitude and so on.

2) Import the hdf into python, access the data (reproject if necessary).
> Yes, it's the merged RGB level 1 data I want to ultimately plot.
>

Importing into python is easy with GDAL. Your reprojection is a problem
because the data aren't even projected. As I said above, they are swath
observations that need to be gridded (Level 2 product).

2b) produce geotiffs for use elsewhere
>

Again, easy using GDAL (provided you don't care about using swath data, OR
that you know how to grid it).

3) Plot the data in basemap, plot some other data (my own, xy tracks,
> points, etc) over the data.
>

Again, you need to know the projection of the MODIS data for this to be of
any use.

I don't have an off-hand way of gridding the Level 1 data, but someone may
have. Other than the MS2GT  (MODIS Swath
to Grid toolbox), there's also the information given in <
http://www.mcst.ssai.biz/mcstweb/L1B/product.html>, and I guess you could
use that as a way of developing a python MS2GT ;D

Jose
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Refer to matplotlib sphinx plots

2009-11-26 Thread Jose Gomez-Dans
Hi,
I'm not sure this is entirely on-topic as it relates to the matplotlib
sphinx extension. I hope it's still acceptable!

I am writing some documentation using sphinx, and I would  like to refer
plots that are rendered from an external python script. I can do the plot
and it gets imported fine just by issuing

.. plot:: ../samples/MyPythonPlot.py

I would like to have a cross reference to it and a caption. If I were to
select a normal figure, I could do this just by (see <
http://sphinx.pocoo.org/markup/inline.html#cross-referencing-arbitrary-locations
>)

.. _my-figure:

.. figure:: whatever

   Figure caption

But how can I do this with a matplotlib plot rather than a png file?

Thanks!
J
--
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] Arrows between points in a plot?

2009-11-29 Thread Jose Gomez-Dans
Hi,
2009/11/29 Michael Cohen 

> Hi all,
>
> I have a plot that has say 6 black X's, each separate, and 6 blue X's,
> also separate, denoting where x's 1-6 have moved to (from black to blue).
> Currently each point is plotted with a separate plot function.
> I would like to generate a plot where each black x and blue x pair has
> an arrow pointing from one to the other.
>

See this cookbook entry: 

What I usually do in these circumstances (and what is demonstrated in the
cookbook entry) is to plot the points, and then add an arrow patch for each
pair:
arrow = pylab.Arrow ( x_from, y_from, distance_x, distance_y )
ax = pylab.gca()
ax.add_patch(arrow)

Hope that helps!
Jose
--
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] bluemarble is too dark

2009-12-14 Thread Jose Gomez-Dans
Hi,

2009/12/14 Dr. Phillip M. Feldman 

> When I generate a map with a background generated via Basemap.bluemarble(),
> the background is extremely dark.  Is there any way to get a
> lighter/brighter version?  (I've looked at all of the available parameters,
> but none of them seems to allow for adjustment of the luminance).
>

I find this problem when generating a PDF and viewing it in Linux,but the
on-screen version seems to work fine. One reason for your darkness might be
the actual bluemarble scene. There is one for every month <
http://earthobservatory.nasa.gov/Features/BlueMarble/>, so you can have a
look at the different month and pick u which is better for your
area/application. Another thing you can do is to modify the bluemarble that
comes with matplotlib using the gimp, as it is just an image file you can
edit easily. Starts looking like data cooking, tho' ;-)

J
--
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] advaced scatter plot

2009-12-14 Thread Jose Gomez-Dans
Hi!

2009/12/14 jenya56 
>
> 1.) How to control the size of each circle on the scatter plot
>

Use the "s" option to scatter (units are points**2)


> 2.) How to add the coast line with lambert projection?
>

You want to use the basemap extension. An example can be found in this blog:
<
http://stevendkay.wordpress.com/2009/10/12/scatter-plots-with-basemap-and-matplotlib/
>

Cheers,
Jose
--
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Re-projecting raster data with Basemap

2008-09-08 Thread Jose Gomez-Dans
Jeff,

On Mon, Sep 8, 2008 at 6:48 PM, Jeff Whitaker <[EMAIL PROTECTED]> wrote:

> Note that to plot the data with pcolor/pcolormesh of contourf, you don't
> need to interpolate to a native projection grid.  You can just do
>
> lons, lats = np.meshgrid(lons,lats)
> x,y = m(lons,lats)
> im = m.pcolormesh(x,y,datain)


OK, I've gone down the pcolormesh route. Results is very nice. However, if I
try to save my file as an EPS or PDF, it takes a long time, and the
resulting PDF is 12Mb (!). The equivalent EPS is of the order of 500MB
(), and the PNG is around 100kb (!). I have a really hard time
rendering either the EPS or the PDF, and I guess that using pcolormesh
somehow sticks all the pixels into the resulting "page". My image size is
around 1000x2500 pixels, and I'm not particularly bothered if it is smoothed
for "presentation purposes" (in fact, I think I can see some aliasing, but
don't have the plot in front of me right now).

I don't recall this problem when using imshow (no basemap involved). Is this
a pcolormesh "feature" (or converseley, an imshow feature?). Is there some I
can make my plots be as reasonable as other MPL plots that are mostly
vectors rather than rasters?

Cheers,
J



-- 
Centre for Terrestrial Carbon Dynamics
Department of Geography, University College London
Gower Street, London WC1E 6BT, UK
-
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=100&url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Saving a basemap plot background

2009-03-02 Thread Jose Gomez-Dans
Hi!

[I think the message didn't get through the first time I sent it. Resending,
and apologies if you get it twice]

I have a rather complex basemap-derived plot that I want to save as
animation.
In essence, it uses the blumarble() to add a nice background, plots some
stuff on top of that, and also has an inset with a map of the world that
shows the area of the main map.

The problem is that memory usage as I iterate through the frames that will
eventually make up my animation, rises very fast. I read a post some time
ago
on how to store the background, so it didn't have to be recreated everytime
here:


There's an example on how to actually do this for basemaps from J Whitaker,
but I can't get this to work on my example. Ideally, I would like to store
the inset in a function, and my main background in another function, and
restore each axis directly. My attempt follows (which produces a blank
image)
is at 

Many thanks!
Jose
--
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] Saving a basemap plot background

2009-03-02 Thread Jose Gomez-Dans
Jeff, thanks for your comment

2009/3/2 Jeff Whitaker 

>
> Jose: I think the key is to only create the basemap instance only once (for
> the main plot and for the inset), then re-use that basemap instance each
> time you create an animation frame.


That helps in memory consumption, and that's something I looked into.
However, my basemap instances are defined (in the case of the inset) as:
 m2 = Basemap(projection='ortho',lon_0=6,lat_0=-12,ax=ax2)
Actually, they both have references to axes. The bit I don't really
understand is how to define my basemap only once and then just "hang it"
from some axes.

Additionally, I am warping a fairly large image (not shown in my example),
so that it takes quite a long time to process. This is only seldom updated,
so I could just save the background and overlay on it my data. As I see it,
even if I recycle the basemap instance, I'd still have to go through the
process of warping my image, extracting coastlines, etc. It would be faster
to just save it, and recreate it whenever it is necessary. I don't really
know how to do this.

I have changed my code by shamelessly copying from your previous advice ;p
(see ). Things improve a bit, but my
parllels/meridians are not aligned with the map. Clearly I'm still missing
something!

Many thanks for your help,
Jose
--
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] Saving a basemap plot background

2009-03-03 Thread Jose Gomez-Dans
Jeff,

I've been doing some more tests today.

2009/3/3 Jeff Whitaker 

>
>Jose: I think the key is to only create the basemap instance only
>>once (for the main plot and for the inset), then re-use that
>>basemap instance each time you create an animation frame.
>>
>> That helps in memory consumption, and that's something I looked into.
>> However, my basemap instances are defined (in the case of the inset) as:
>>  m2 = Basemap(projection='ortho',lon_0=6,lat_0=-12,ax=ax2)
>> Actually, they both have references to axes. The bit I don't really
>> understand is how to define my basemap only once and then just "hang it"
>> from some axes.
>>
>
> Jose:  You can create the Basemap instance once, and then pass the axes
> with the ax keyword whenever you call a basemap method.
>

OK, I wasn't aware of this. However, memory consumption still flies. I am
aware that it could be other bits of the program that are eating up loads of
memory, but I don't know how to test where the bottleneck is. In the end, I
resorted to getting rid of basemap instances, but the problem persists.
There must be something in what I'm doing that's eating memory up, but I'm
not sure how to check what it is.

I'll try installing guppy and see whether that shines a light...
Thanks!

Jose
--
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] Saving a basemap plot background

2009-03-05 Thread Jose Gomez-Dans
Jeff,
Solved, I think!

2009/3/3 Jose Gomez-Dans :
> OK, I wasn't aware of this. However, memory consumption still flies. I am
> aware that it could be other bits of the program that are eating up loads of
> memory, but I don't know how to test where the bottleneck is. In the end, I
> resorted to getting rid of basemap instances, but the problem persists.
> There must be something in what I'm doing that's eating memory up, but I'm
> not sure how to check what it is.

A message to the list suggested that calling pyplot.close( fig_num)
freed up the memory used, which I'm happy to report, is happening. I
still haven't managed to "cut and paste" a background into my figures,
but we'll get there... eventually!!!

Thanks!
Jose

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


[Matplotlib-users] Density slice scatter plot

2009-05-05 Thread Jose Gomez-Dans
Hi,
I would like to plot a density slice scatter plot (when you have lots of
points superimposed, it's very useful). An example from IDL/envi is here: <
http://www2.geog.ucl.ac.uk/%7Eplewis/geog2021/practical1/scatter3.gif>

My rustic approach to solving this problem has been to bin all my data
points into a 2D array (each point that falls in a given cell adds one to
that cell), and then use the c argument in scatterplot to map the color to
the number of samples in the corresponding bin. Is there a better way of
achieving this, as I need a fair bit of tweaking to get the color scales
right?

Thanks!
J
--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] [basemap] EASE grid projection

2012-08-28 Thread Jose Gomez-Dans
Hi,
I'd like to plot some EASE Grid global data (the EASE grid is defined for a
cylindrical equal area projection). In proj4 parlance, it is defined as

+proj=cea +lon_0=0 +lat_ts=30 +x_0=0 +y_0=0 +a=6371228 +b=6371228 +units=m
+no_defs

My data are gridded, and I want to use either pcolormesh or imshow to plot
them on a map. Apart from reprojecting into something that basemap deals
with natively, is there something else that I can do within
python/matplolib to plot the data without reprojecting it?

Thanks!
Jose
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] interpolate inside a circle

2010-05-26 Thread Jose Gomez-Dans
On 26 May 2010 17:20, Carlos Grohmann  wrote:

> I can interpolate my data using rbf, but only inside a rectangular
> area (mesh). I'm looking into how to interpolate data inside a
> circular area, that is, disregarding anything outside a circle (or a
> polygon, like a convex hull)
>

If you can define your polygon/circle, you can filter your points and select
only those within the boundary. You can do this with pnpoly if you have
matplotlib (see this: <
http://matplotlib.sourceforge.net/faq/howto_faq.html#test-whether-a-point-is-inside-a-polygon>).
You can then interpolate your points, into a regular grid, and discard the
gridcell values outside your region of interest.

J
--

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


Re: [Matplotlib-users] Histogram without binning

2011-01-08 Thread Jose Gomez-Dans
Hi,

On 8 January 2011 18:57, OKB (not okblacke)  wrote:
> Is there a simple way to get a
> histogram that does not bin any values together at all, but simply
> creates one bar for each distinct value in the dataset?

You can just use the bins keyword to plt.hist (or np.hist):
plt.hist ( x, bins=np.unique ( x ) )

Jose

--
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plotting data from a csv file on a basemap

2007-01-19 Thread Jose Gomez-Dans
Tim,

On 1/19/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

> how can I read data in that
> x gets the latitude
> y gets the longgitute
> z gets the data which will be shown in different color accoring to their 
> values?

Use pylab.load to load the data into an array. Then, the rest of what
you want to accomplish is detailed in the wiki:
.

Hope that helps!
José

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] imshow restricted to circle

2007-05-16 Thread Jose Gomez-Dans
Hi,

On 5/16/07, Thorsten Kranz <[EMAIL PROTECTED]> wrote:
> Hi, I have a question about the command "imshow". Is there a way to have
> such a colorplot only limited to a circular area?
>
> I want to have it look like the colorplots in
>
> http://www.uke.uni-hamburg.de/kliniken/neurologie/downloads/klinik-neurologie/Hummel_Figure7.jpg

I have used the same sort of plots for the polar regions, where you
sometimes want to concentrate on one single annulus. One thing you can
do is to have a mask, with the same size as your matrix. You calcualte
r_ij = sqrt(xi*xi + yj*yj), set a threshold U and let the mask be
equal to 1 if r<=U, or else 0. When you apply the mask, the area
outside your radius of interest will be masked out.

I know, I know... long winded :)

Cheers,
Jose

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Setting zorder for twinx plots

2007-05-18 Thread Jose Gomez-Dans
Hi,
We are trying to plot a climogram (where you have temperature on the
left hand axis, and precipitation on the RHS). The data need to be
properly scaled as well. We have used twinx() to get the two axes.
However, the precipitation (plotted as bars) goes over the temperature
line, when it should be the other way around. I have tried setting the
zorder of the temperature line to a large value, but to no avail. I
have also tried setting the zorder of the axis of the first plot, but
again, no luck.

How can we plot the lines (belonging to the LHS axis) on top of the bars?

Thanks!
Jose

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] [SPANISH] Python, OGR and Matplotlib

2007-06-10 Thread Jose Gomez-Dans
Hi all,
First, sorry for the crossposting. I have drafted a small document (it
is in Spanish, if there's interest, I'll have a go at translating it)
on how to use OGR from Python access geospatial data, which can be
further analysed or plotted with matplotlib. It is a very brief
introduction, and surely there is much to improve, but I was looking
for something like this for a while, and couldn't find it.

The page is here: 

Cheers,
jose

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Discrete legend

2007-06-12 Thread Jose Gomez-Dans
Hi,
I am plotting a number of polygons with different colours (results
from an image clustering or classification algorithm). I'd like to
have a map-like legend, with a square filled with some colour and some
text describing what it is (a quick search in Google comes up with the
following example:
. Scary,
though hopefully you get the gist of it :D).

I realise that the legend class has some support for patches, but how
does one go about using them? I can't just add a legend (I get a very
messy legend, one for every patch in my plot). I should be able to set
my legend somewhere, but I don't know where to start: pylab.legend?
matplotlib.legend?

Any hints or examples greatly appreciated!
J

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Saving just a colorbar

2007-09-03 Thread Jose Gomez-Dans
Hi,
I am using Matplotlib to produce colormaps which I use with other
programs. I would like to produce a PNG file with the used colormap
(so that I can overlay). Rather than doing an imshow()
followed by colorbar, is there an easy way I could pass the colorbar
my cmap instance to have it plotted on its own? In essence, what I
want to do is to do a savefig, and get something along the lines of
what is shown here: . I will
need to change the scale (i.e.,, the numbers :D) with each run.

So far, I have "cut+pasted" from a whole image, which is hardly convenient! :(

Cheers,
Jose

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] legend bg color?

2007-09-10 Thread Jose Gomez-Dans
Hi,

On 9/5/07, Patrick Bradley <[EMAIL PROTECTED]> wrote:
> lg = legend()
> lg.get_frame().set_facecolor('black')

Does anyone know how to set this background to transparent? I think I
sent a message to the list a few days ago, but I think it never made
it...

Cheers!
Jose

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] legend bg color?

2007-09-11 Thread Jose Gomez-Dans
Hi Patrick,

Thanks for your message!

On 9/10/07, Patrick Bradley <[EMAIL PROTECTED]> wrote:
> lg = legend()
> lg.get_frame().set_fill(False)

Mmmm, this is OK, let's say I wanted a figure with a transparent
background. I can't find a set_fill() method for this class. I have
tried the facecolor attribute, but no luck. I think I got this right.
I am using the Agg backend (does this make a difference?). The files
are RGBA pngs, but the alpha channel is always 255, so my background
is always white, as opposed to transparent.

Am I doing something wrong? I am using matplotlib 0.90.0. Here's some
sample code

import pylab
FaceColor=(1.0, 1.0, 1.0, 0.0 )
fig = pylab.figure(figsize=(6,1.5))
ax = fig.add_axes([0.05, 0.4, 0.9, 0.5])
cmap = mpl.cm.jet
norm = mpl.colors.Normalize(vmin=0, vmax=1)
cb = mpl.colorbar.ColorbarBase(ax, cmap=cmap, \

norm=norm,orientation='horizontal' )
cb.set_alpha(0.0)
fig.set_facecolor(FaceColor)
pylab.savefig( "fichero.png", dpi=72, facecolor=FaceColor)

cheers!
José

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Geo raster

2007-09-20 Thread Jose Gomez-Dans
Hi Lionel,

On 9/20/07, Lionel Roubeyrie <[EMAIL PROTECTED]> wrote:
> Hi Jeff,
> thanks for the reply. Effectively, I saw the warpimage example, and based on
> that I just want to know if somebody has already used the PCL module to
> retrieve geographical informations (or another module).

With GDAL, it's trivial. I work with data from many sources, and I am
usually bypassing basemap altogether and going GDAL/OGR+MPL.

To show the first band of a raster map, I just do the following:
import pylab
import gdal

fname="/path/to/file"

g = gdal.Open ( fname)
data = g.GetRasterBand(1).ReadAsArray()
#data is a Numeric/numpy array. Can modify at will
pylab.imshow(data)
pylab.show()

Cheers,
Jose

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] IDL Font question

2007-10-31 Thread Jose Gomez-Dans
Hi,
Some colleagues have sent some plots which they generated using IDL
(boo!!! hiss!! :D), and they look quite dissimilar to my matplotlib
ones. I would like to mimic their layout as much as possible, which so
far is a success. The only problem is that I don't know what font to
use. In IDL, I believe it is called "Roman" (there's an smudged
example here: ).
Does anyone know a suitable alternative?

Thanks!
Jose

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Redraw axis

2008-02-28 Thread Jose Gomez-Dans
Hi!
I have two datasets with different data coordinates, which I want to plot on
different subplots, all showing the same extent. I want to be able to zoom
into one of the subplots, and have the other follow (through some conversion
of the former's extent).
Initially, I just want one plot to follow the other (but I could easily
extend that to both plots if needs be). The code works, but I cannot update
my plots automatically, although I call  pylab.draw(). What's the way to
have my plots respond to my events without dragging the window borders,
resizing the window, etc? I am using matplotlib 0.90.1 and GTKAgg backend on
Linux. Here's some code snippet of what I am doing:

fig=pylab.figure()
ax =fig.add_subplot(211)
xtent1=(950.520,3335851.559,-2223901.039,-950.520)
xtent2=(0,2477,0,2319 )
im1=ax.imshow( image1,extent=xtent1,picker=True)
ax2=fig.add_subplot(212)
im2=ax2.imshow( image2)
ax2.set_xlim (1073, 1797)
ax2.set_ylim (1944, 1588)
pylab.draw()
def pick_new_extent(event):
artist = event.artist
(xlow,xhigh) = artist.get_axes().get_xlim()
(ylow,yhigh) = artist.get_axes().get_ylim()
[xmin, xmax, ymin, ymax] = CalculateWindowCoordinates(xlow, xhigh,
ylow, yhigh) #This does the coordinate transformation

ax2.set_xlim(xmin,xmax)
ax2.set_ylim(ymax, ymin)
pylab.draw() #Why doesn't the window refresh when it gets here? I
need to change the window size to get it to refresh!!
fig.canvas.mpl_connect('pick_event', pick_new_exent)

Thanks!
Jose

-- 
Centre for Terrestrial Carbon Dynamics
Department of Geography, University College London
Gower Street, London WC1E 6BT, UK
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Redraw axis

2008-02-28 Thread Jose Gomez-Dans
Hi,

On Thu, Feb 28, 2008 at 1:47 PM, John Hunter <[EMAIL PROTECTED]> wrote:

>
> If I understand what you are trying to do, you should be using the
> sharex and sharey settings for ax1


Mmm, I don't think so.  The extent of one image and other are in different
units, so I need to transform whatever value it is I have in one image to
the corresponding window in the other image. I don't know whether there's an
explicit way to let matplotlib know of a transformation function for this.

Not sure (it should) but I would use fig.canvas.draw() here in any case.
>

Your suggestion works fine! Thanks!
Jose

-- 
Centre for Terrestrial Carbon Dynamics
Department of Geography, University College London
Gower Street, London WC1E 6BT, UK
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Show shapes on scatterplot legend?

2008-03-01 Thread Jose Gomez-Dans
Hi,

On Thu, Feb 28, 2008 at 7:45 PM, chombee <[EMAIL PROTECTED]> wrote:

> The problem is that the legend displays only a rectangular block
> indicating the color for each plot. Is there a way to get the marker
> shapes of scatter plots into the legend?
>

I faced a similar problem some time ago, and got some help from the list:


Meaning: you can create a Patch, fill it with some colours, and stick it in
the legend. It might be too much of a hassle. However, there might be an
easy mapping between the marker and the patch?

J

-- 
Centre for Terrestrial Carbon Dynamics
Department of Geography, University College London
Gower Street, London WC1E 6BT, UK
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Plotting different years on the same axes

2006-06-23 Thread Jose Gomez-Dans
Hi!I searchd in the documentation, but couldn't find anything useful. I want to be able to plot a couple of yearly time series (so that one can see the difference between some variable in one particular year with respect to another year). Additionally, I would also like to have a plot of the mean (and stanard deviation) of several years, and to plot another time series on those same axes. I was wondering if there is some better solution to the one I found, which involves subtracting the 1st of January of the year in the data and using the Julian date. I would like to use day/month markers on the plot, but apart from referring all the plots to the same year (by adding or subtracting a fixed value to each year), which is a bit mesy, I haven't been able to do this. Is there something I can easily do to have my plot from January to December showing two curves with dates from 01/Jan/2001 to 31/Dec/2001 and the other with dates running from 01/Jan/2004 to 31/Dec/2004?
Cheers!jose
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] White squares in Unicode strings

2006-06-28 Thread Jose Gomez-Dans
Hi!I have some unicode strings to insert accents into plot titles, axes and labels. As output, I produce both PNGs and EPS files. I don't select any backend (I guess TKAgg is chosen by default), and run the program on Windows. I use matplotlib 
0.87.Anyway, the problem is that in the EPS files, the Unicode strings show some white squares where a space should go. The PNG files are fine. If I don't use Unicode, then no problem. I am attaching a small sample as a PNG (captured fro a PS viewer).
What's going on? Seems related to Unicode strings, but is there a way to write labels with accents (iso-8859-1) without restoring to unicode?Many thanks!Jose



matplotlib_problem.png
Description: PNG image
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] "Stacked" subplots

2006-09-14 Thread Jose Gomez-Dans
Hi!
I am coding a little application that shows a number of subplots (of
the 511, 512...515 type) stacked up. They all have the same x-axis,
and I want them to only have the xticks labels on the downward most
axes. The subplots are defined in a matplotlib.figure.Figure object,
and have been created using the add_subplot() method. I am unsure on
how to go about squeezing the plots vertically (although the
subplots_adjust method seems to solve this), and how to get rid of the
axis.

Ideally, I would also like to have a legend OUTSIDE the subplots. Is
this possible given that the Figure is inserted in a wxFrame?

I'm a newbie when it comes to both MPL and wxWindows, so sorry if this
sounds very vague. I'm happy to provide more information, only that
I'm not sure of what! :D

Cheers for your time,
Jose

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Date conversion

2006-11-07 Thread Jose Gomez-Dans
Hi!
We are tryint to access time data stored in an SQL The query returns a
date object of type DbiDate. When printed, we get a nicely formatted
text date. If cast into a float or int, you get the number of seconds
elapsed since 1/1/1970. The way we are dealing with the conversion
from this format into MPL format is:through time.strptime (using a
format string), then converting that into a datetime object, and
finally invoking MPL's date2num.

Is there a better, quicker more obvious way to accomplish this?

Thanks!
Jose

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Plotting shapefiles

2006-11-16 Thread Jose Gomez-Dans
Hi!
I don't know whether it is easy to produce a plot of a shapefile (a
geographical information systems vector file format, with an attached
database) using MPL: An example would be to have the a map with the
mean temperature for every country in the month of august mapped to a
colour. The shapefile has a "dbf" database with the temperature, and
the polygons making up the country boundaries can be extracted with
GDAL/OGR.

Has anyone done anything like this? I guess that for very detailed
shapes (lots of polygons with loads of vertexes), it might be slow,
and of course, we need to get the data into Python first, but any
pointers would be very welcomed!

Cheers!
Jose

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users