Re: [Matplotlib-users] Information request

2008-09-26 Thread Antoine De Pauw
Jeff,

I totally agree this is due to missing values

Again I've got difficulties to find good words so forgive me, what I tried
to say is that the ability to have that border transparent would be a good
feature in next releases, for people who need to interpolate and plot such
data and have an aesthetic result

Imshow is the ideal candidate for satellite data as it has some nice
interpolation features and it is fast, so it can be batch-run on the server
every time we receive data, without too much computation time

The alternative I'm using now is a double or quadruple size grid to reduce
the width of that border, with background color set to the lower colormap
color

That way, the border is really hard to see and it makes (almost) quality
plots for publications

-Original Message-
From: Jeff Whitaker [mailto:[EMAIL PROTECTED] 
Sent: Thursday, 25 September, 2008 15:34
To: De Pauw Antoine
Cc: 'Matplotlib Users'
Subject: Re: [Matplotlib-users] Information request

De Pauw Antoine wrote:
 Jeff,

 Thanks for the tip, it's now working perfectly

 However, there's still that border with the imshow plot, and I think it
 would be good to have it transparent

 There's a zoomed picture I made:
 http://img218.imageshack.us/img218/5833/imshowborderxz9.png

 You see the shadow around the data...

 It would be nice for next releases of Matplotlib to get rid of that, but
I'm
 not able to patch it myself or so... I know there's still a lot of work
with
 the lib but keep the good work, it is really fantastic

 Thanks for your help!

 Antoine De Pauw
 Collaborateur de recherches, Informatique - Research collaborator, IT
 Laboratoire de chimie quantique et photophysique - Quantum chemistry and
 photophysics laboratory
 Université Libre de Bruxelles - ULB
   

Antoine: I thought we agreed that it's not an imshow bug - but rather 
due to the griddata gridding procedure returning missing values outside 
the convex hull of the input data. Do you disagree? I see no such border 
around an imshow plot that contains no missing values. If you shrink the 
size of the map plotting region so it's fully within the convex hull of 
the data, the border disappears.

-Jeff
 -Original Message-
 From: Jeff Whitaker [mailto:[EMAIL PROTECTED] 
 Sent: jeudi 25 septembre 2008 14:15
 To: De Pauw Antoine
 Cc: 'Matplotlib Users'
 Subject: Re: [Matplotlib-users] Information request

 De Pauw Antoine wrote:
   
 Hi Jeff,

 I finally found out how to fill my figure with a background color using
 axes.set_axis_bgcolor(color), but I'm facing the following problem now:

 How could I get the lower color of a colormap? This is quite undocumented
 and I don’t know the colormap properties I could use for that

 I know there must be an accessible value somewhere, like for the
 ax.get_yticklabels() you gave me

 If someone had the clue, my problems would then be completely solved

 Antoine De Pauw
 Collaborateur de recherches, Informatique - Research collaborator, IT
 Laboratoire de chimie quantique et photophysique - Quantum chemistry and
 photophysics laboratory
 Université Libre de Bruxelles - ULB
   
 

 Antoine: To get the RGBA value associated with a particular data value, 
 just call the colormap as a function as pass it that value. For example

   import matplotlib.pyplot as plt
   plt.cm.jet(1)
 (0.0, 0.0, 0.517825311942959, 1.0)

 BTW: the 'fill_color' kwarg of drawmapboundary basemap method allows you 
 to set the background color of the map.

 http://matplotlib.sourceforge.net/basemap/doc/html/api/basemap_api.html

 It fills only the map region (which for some projections, like the 
 orthographic, is not the same as the axes region).


 -Jeff
   
 -Original Message-
 From: Jeff Whitaker [mailto:[EMAIL PROTECTED] 
 Sent: mardi 23 septembre 2008 20:38
 To: De Pauw Antoine
 Cc: 'John Hunter'; 'Matplotlib Users'
 Subject: Re: [Matplotlib-users] Information request

 De Pauw Antoine wrote:
   
 
 Jeff,

 I still don't know how to either remove this artifact or fill my arrays
 
   
 with
   
 
 values to remove empty regions, and I'll make a last attempt to resolve
   
 it
   
 I uploaded a data file here: http://scqp.ulb.ac.be/20080821.b56

 The actual code snippet is here:
 http://snipplr.com/view/8307/map-plotting-python-code-temporary/

 I hope you'll be able to reproduce it, I set the cmap to winter for you
   
 to
   
 see the gap... setting it to hot will make the grayish border visible in
 high resolution by zooming it... I think the border (not the empty zone)
 could be an artifact with the hot colormap


 Antoine De Pauw
 Collaborateur de recherches, Informatique - Research collaborator, IT
 Laboratoire de chimie quantique et photophysique - Quantum chemistry and
 photophysics laboratory
 Université Libre de Bruxelles - ULB

   
 
   
 Antoine:  Here is a version that just plots the pixels directly, without 
 interpolating to a grid.  I personally like this better, since you can 
 

[Matplotlib-users] Legend over plot lines

2008-09-26 Thread Peter Saffrey
Is there a way to automatically resize plots (and subplots) and 
move/resize plot legends so that they don't obscure the plotted data? I 
have this problem especially on plots with 4 or 5 tracks.

I can post an example, but I wasn't sure of the etiquette of posting 
images to this list.

Cheers,

Peter

-
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] Legend over plot lines

2008-09-26 Thread Friedrich Hagedorn
On Fri, Sep 26, 2008 at 12:52:01PM +0100, Peter Saffrey wrote:
 Is there a way to automatically resize plots (and subplots) and 
 move/resize plot legends so that they don't obscure the plotted data? I 
 have this problem especially on plots with 4 or 5 tracks.
 
 I can post an example, but I wasn't sure of the etiquette of posting 
 images to this list.

Yes as *.png. I think it's convinient to understand your problem in a
few seconds.

By,

  Friedrich

-
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] bluemarbel image boundaries in robinson projection

2008-09-26 Thread Momme Butenschÿfffff6n
When plotting a global image using the robinson projection and the bluemarble 
image, I have the problem that the image remains rectangular and goes beyond 
the curved projection map boundaries (see attachment). Is there anyway around 
this?

Cheers,
Momme

import mpl_toolkits.basemap as b
import numpy as np
def draw(center=11.,latres=10.,lonres=10.):
  m = b.Basemap(projection='robin',lon_0=center)
  m.drawcoastlines()
  m.drawmapboundary()
  m.drawmeridians(np.arange(0,360,lonres),color='0.5',labels=[0,0,0,1])
  m.drawparallels(np.arange(-90,90,latres),color='0.5',labels=[1,0,0,0])
  im=m.bluemarble()
  return m



  -
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] plotting scattered data from array

2008-09-26 Thread Goyo
El jue, 25-09-2008 a las 22:19 +0200, Oz Nahum escribió:
 ¿What's the meaning of that data arrange? I can't make any sense of
 plotting a 2D scatter from a 3D array.
 
 when I wrote:
 head = [[0,0,10],
 [1,0,13],
 [2,0,11],
 [3,0,12],
 [1,2,11]]
 
 my meaning was to represent point of intereset with x, y coordinates
 and the 3rd number was height for example. 
 I felt like I couldn't access the individual points easily, because
 their are located in on big list...
 So I wanted to have the list broken into rows, and the each row
 represents a value on the y axis... like this:
 head = [
 [[0,0,10], [0,0,13]],
 [[2,0,11], [3,0,12]],
]

Mm... maybe this is better for your eyes but not for processing, I
think.

   
 But that's redundant I think now, after looking into the function
 zip. 
 Maybe I could write head in the following way:
   
   #   j = 0 1
 head = [
 [[0,10], [1,13]], # i =0
 [[0,11], [1,12]], # i =1
]

The same. Parsing a data file usually yields a sequence of rows
(records), data processing functions usually expects columns of
homogeneous data and convert from records to columns and back is pretty
straightforward using zip. If you want to use a different representation
for your data you'll need to handle more complex structures and
conversions. Do it if you think it pays (sometimes it does).

 But actually after understanding what zip does, I think I don't need
 it anyway...
 Talking about this: can you give me an example of another use of zip ?
 not just zip(*head)
 
 I did help(zip) but I could partially understand what it does. I
 learned more by doing:
 x,y,z = zip(*head)
 and then printing x,y,z individually.

There is no other use I can think of. If you think of the arguments
passed to zip as rows, it returns the columns. If the arguments are
columns, zip returns rows. How you name things depends on how you think
of your data. There is no other use I can think of.

zip expects each row (if they are rows) to be passed as an argument so
you usually need that * thing to unpack them. When you call zip(*x), x
being a sequence or array-like, you are actually passing each element of
x as an argument to zip.

Try this:

numbers = [1, 2, 3, 4, 5]
english = ['one', 'two', 'three', 'four', 'five']
spanish = ['uno', 'dos', 'tres', 'cuatro', 'cinco']
x = [numbers, english, spanish]
zip(numbers, english, spanish)
zip(x)
zip(*x)

You can learn about unpacking and zipping sequences reading the Python
Tutorial or another similar resource (maybe Dive into Python dives into
it, not sure but a useful reading anyway).

Goyo


-
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] formatting figures for publciation

2008-09-26 Thread Gideon Simpson
Is there anything akin to this MATLAB script:

http://www.mathworks.com/company/newsletters/digest/june00/export/

available for mpl?  or some simple set of commands that will  
accomplish the same task?
-gideon


-
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