Re: [Matplotlib-users] py2exe with pylab

2007-09-20 Thread Werner F. Bruhin
Hi Emmanuel,

Emmanuel wrote:
 With the setup you provided. I could get py2exe to make an exe of the 
 simple_plot.py from simple_plot_wxagg of py2exe examples.
I use matplotlib only from within wxPython, that is why I used this 
example script.

Which of the matplotlib example script is closest to what you want to 
do?  If you let me know I try to create/adapt the setup.py for it.

Werner

-
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] Drawing filled circles (discs)

2007-09-20 Thread sidimok


Mika, David P (GE, Research) wrote:
 
 How about this solution?  I'm a complete newbe, but this seems to do the
 trick.  I didn't see a CircleCollection so I used CirclePolygon to
 generate vertices for a circle; these I grab and toss into a
 PolyCollection.  Enjoy, Dave
 
 

Hi all!

Thank you very much indeed for the help, both solutions work like a charm.
However Dave's one gives rough cirlces, approximated by polygones, which is
not very accurate for my buisness. May I ask how to create a
circleCollection as Jouni The Expert proposed?
You can find below one of my plottings rendered by Jouni's first trick.

http://www.nabble.com/file/p12793350/image.png 
-- 
View this message in context: 
http://www.nabble.com/Drawing-filled-circles-%28discs%29-tf4441651.html#a12793350
Sent from the matplotlib - users mailing list archive at Nabble.com.


-
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] activate/deactivate RectangleSelector

2007-09-20 Thread Matthias Michler
Hello developers,

I'm sorry for reposting again. I really would like to have this feature in 
mpl. 
Please let me know if there is anything I can do to change my proposal to make 
it match with matplotlib.


thanks in advance and best regards,
Matthias


-
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] Geo raster

2007-09-20 Thread Lionel Roubeyrie
Hi all,
Can't find any examples on google, then I come here to see if it's possible to 
display a georeferenced map (geotiff on my side) into Basemap.
The PCL module seems great, but there's not useful information on the Trac 
website.
Thanks

-- 
Lionel Roubeyrie - [EMAIL PROTECTED]
Chargé d'études et de maintenance
LIMAIR - la Surveillance de l'Air en Limousin
http://www.limair.asso.fr


-
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 Jeff Whitaker
Lionel Roubeyrie wrote:
 Hi all,
 Can't find any examples on google, then I come here to see if it's possible 
 to 
 display a georeferenced map (geotiff on my side) into Basemap.
 The PCL module seems great, but there's not useful information on the Trac 
 website.
 Thanks

   
Lionel:  There's an example in Basemap (warpimage.py) of displaying a 
plain old png file on different map projections.  If you can figure out 
how to read a geotiff (I've never tried it, but GDAL should be able to 
do it), you should be able to use the projection information in the file 
to figure out the lat/lon values of each pixel.  Then you could follow 
the warpimage.py example to transform it to some other map projection.  
Or, if you want to display it in it's native projection, just use the 
projection information in the geotiff to define a Basemap instance, 
extract the rgba values and plot them with Basemap.imshow.

-Jeff

-- 
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: 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] Drawing filled circles (discs)

2007-09-20 Thread Mika, David P (GE, Research)
In the solution I gave, CirclePolygon has a resolution argument for
number of vertices to approximate the circle (default=20).  You could
increase that value to some more appropriate level:

import matplotlib
from matplotlib.patches import CirclePolygon
from matplotlib.collections import PolyCollection
import pylab 

fig=pylab.figure()
ax=fig.add_subplot(111) 

resolution = 50 # the number of vertices 
N = 20
x   = pylab.rand(N)
y   = pylab.rand(N)
radii   = 0.1*pylab.rand(N)
colors  = 100*pylab.rand(N)
verts   = []
for x1,y1,r in zip(x, y, radii):
circle = CirclePolygon((x1,y1), r, resolution)
verts.append(circle.get_verts())

p = PolyCollection(verts, cmap=matplotlib.cm.jet)
p.set_array(pylab.array(colors))
ax.add_patch(p)
pylab.colorbar(p)

ax.axis('equal')
pylab.show()



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
sidimok
Sent: Thursday, September 20, 2007 4:59 AM
To: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] Drawing filled circles (discs)



Mika, David P (GE, Research) wrote:
 
 How about this solution?  I'm a complete newbe, but this seems to do 
 the trick.  I didn't see a CircleCollection so I used CirclePolygon to

 generate vertices for a circle; these I grab and toss into a 
 PolyCollection.  Enjoy, Dave
 
 

Hi all!

Thank you very much indeed for the help, both solutions work like a
charm.
However Dave's one gives rough cirlces, approximated by polygones, which
is not very accurate for my buisness. May I ask how to create a
circleCollection as Jouni The Expert proposed?
You can find below one of my plottings rendered by Jouni's first trick.

http://www.nabble.com/file/p12793350/image.png
--
View this message in context:
http://www.nabble.com/Drawing-filled-circles-%28discs%29-tf4441651.html#
a12793350
Sent from the matplotlib - users mailing list archive at Nabble.com.



-
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

-
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 Lionel Roubeyrie
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).

Le jeudi 20 septembre 2007, Jeff Whitaker a écrit :
 Lionel Roubeyrie wrote:
  Hi all,
  Can't find any examples on google, then I come here to see if it's
  possible to display a georeferenced map (geotiff on my side) into
  Basemap.
  The PCL module seems great, but there's not useful information on the
  Trac website.
  Thanks

 Lionel:  There's an example in Basemap (warpimage.py) of displaying a
 plain old png file on different map projections.  If you can figure out
 how to read a geotiff (I've never tried it, but GDAL should be able to
 do it), you should be able to use the projection information in the file
 to figure out the lat/lon values of each pixel.  Then you could follow
 the warpimage.py example to transform it to some other map projection.
 Or, if you want to display it in it's native projection, just use the
 projection information in the geotiff to define a Basemap instance,
 extract the rgba values and plot them with Basemap.imshow.

 -Jeff



-- 
Lionel Roubeyrie - [EMAIL PROTECTED]
Chargé d'études et de maintenance
LIMAIR - la Surveillance de l'Air en Limousin
http://www.limair.asso.fr


-
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] creating a timeline

2007-09-20 Thread Ryan Krauss
I would need to create a timeline for a Latex document (eps output).
There may be other tools besides Matplotlib and I am open to
suggestions.  But I were going to use mpl, what would it take to do
something along these lines:
http://www.timelinemaker.com/product-samplecharts-constructiontimeline.html

Basically, I would need a nicely formatted dates along the x-axis and
then lightly colored rectangles with text in them.  The width would
show when I anticipate some part of the project starting and ending.
The y coordinate of the rectangle would used to allow project portions
to overlap.  It would be nice but not essential if the rectangles had
a little fade in and out in their back ground color instead of a solid
color, but that is not essential.

Is there a clean way to do this with mpl?

Thanks,

Ryan

-
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] creating a timeline

2007-09-20 Thread John Hunter
On 9/20/07, Ryan Krauss [EMAIL PROTECTED] wrote:
 I would need to create a timeline for a Latex document (eps output).
 There may be other tools besides Matplotlib and I am open to
 suggestions.  But I were going to use mpl, what would it take to do
 something along these lines:
 http://www.timelinemaker.com/product-samplecharts-constructiontimeline.html

 Basically, I would need a nicely formatted dates along the x-axis and
 then lightly colored rectangles with text in them.  The width would
 show when I anticipate some part of the project starting and ending.
 The y coordinate of the rectangle would used to allow project portions
 to overlap.  It would be nice but not essential if the rectangles had
 a little fade in and out in their back ground color instead of a solid
 color, but that is not essential.

 Is there a clean way to do this with mpl?

See examples/broken_barh.py (this also allows breaks in the horizontal
bars, eg if an event is interrupted and then resumes).  I haven't
added gradient fills on bars because I don't think they convey little
if any information but just add to the glitz factor (an example of
chart junk to use Tufte's phrase) but at some point we should bow to
popular pressure and add it.  Actually, you can hack gradient filled
bars and axes backgrounds -- be careful, viewing the figure below may
induce seizures.

from pylab import figure, show, nx, cm

def gbar(ax, x, y, width=0.5, bottom=0):
   X = [[.6, .6],[.7,.7]]
   for left,top in zip(x, y):
   right = left+width
   ax.imshow(X, interpolation='bicubic', cmap=cm.Blues,
 extent=(left, right, bottom, top), alpha=1)

fig = figure()

xmin, xmax = xlim = 0,10
ymin, ymax = ylim = 0,1
ax = fig.add_subplot(111, xlim=xlim, ylim=ylim,
autoscale_on=False)
X = [[.6, .6],[.7,.7]]

ax.imshow(X, interpolation='bicubic', cmap=cm.copper,
 extent=(xmin, xmax, ymin, ymax), alpha=1)

N = 10
x = nx.arange(N)+0.25
y = nx.mlab.rand(N)
gbar(ax, x, y, width=0.7)
ax.set_aspect('normal')
show()

-
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] activate/deactivate RectangleSelector

2007-09-20 Thread John Hunter
On 9/20/07, Matthias Michler [EMAIL PROTECTED] wrote:
 Hello developers,

 I'm sorry for reposting again. I really would like to have this feature in
 mpl.
 Please let me know if there is anything I can do to change my proposal to make
 it match with matplotlib.

Committed to svn revision 3867 -- thanks for the patch and reminder.

JDH

-
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] creating a timeline

2007-09-20 Thread Ryan Krauss
bling-bling.  I know it is eye candy and in questionable taste, but I
think it fits my non-technical audience in this case.  I think this is
enough to get me going.  Thanks John.

Ryan

On 9/20/07, John Hunter [EMAIL PROTECTED] wrote:
 On 9/20/07, Ryan Krauss [EMAIL PROTECTED] wrote:
  I would need to create a timeline for a Latex document (eps output).
  There may be other tools besides Matplotlib and I am open to
  suggestions.  But I were going to use mpl, what would it take to do
  something along these lines:
  http://www.timelinemaker.com/product-samplecharts-constructiontimeline.html
 
  Basically, I would need a nicely formatted dates along the x-axis and
  then lightly colored rectangles with text in them.  The width would
  show when I anticipate some part of the project starting and ending.
  The y coordinate of the rectangle would used to allow project portions
  to overlap.  It would be nice but not essential if the rectangles had
  a little fade in and out in their back ground color instead of a solid
  color, but that is not essential.
 
  Is there a clean way to do this with mpl?

 See examples/broken_barh.py (this also allows breaks in the horizontal
 bars, eg if an event is interrupted and then resumes).  I haven't
 added gradient fills on bars because I don't think they convey little
 if any information but just add to the glitz factor (an example of
 chart junk to use Tufte's phrase) but at some point we should bow to
 popular pressure and add it.  Actually, you can hack gradient filled
 bars and axes backgrounds -- be careful, viewing the figure below may
 induce seizures.

 from pylab import figure, show, nx, cm

 def gbar(ax, x, y, width=0.5, bottom=0):
X = [[.6, .6],[.7,.7]]
for left,top in zip(x, y):
right = left+width
ax.imshow(X, interpolation='bicubic', cmap=cm.Blues,
  extent=(left, right, bottom, top), alpha=1)

 fig = figure()

 xmin, xmax = xlim = 0,10
 ymin, ymax = ylim = 0,1
 ax = fig.add_subplot(111, xlim=xlim, ylim=ylim,
 autoscale_on=False)
 X = [[.6, .6],[.7,.7]]

 ax.imshow(X, interpolation='bicubic', cmap=cm.copper,
  extent=(xmin, xmax, ymin, ymax), alpha=1)

 N = 10
 x = nx.arange(N)+0.25
 y = nx.mlab.rand(N)
 gbar(ax, x, y, width=0.7)
 ax.set_aspect('normal')
 show()

 -
 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


-
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] how to control space between ylabel and yticklabel?

2007-09-20 Thread John Hunter
On 9/19/07, Cizhong Jiang [EMAIL PROTECTED] wrote:

 I have a long ylabel that is displayed in two lines. Thus, the ylabel
 overlaps with yticklabels. Does anyone know how to control the space between
 ylabel and yticklabel? Thank you very much.
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Could you provide some example code that shows this problem -- the
layout is supposed to prevent this from happening.

JDH

-
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] errorbar problem

2007-09-20 Thread Manu Hack
import numpy
import pylab

x = y = ybar = numpy.arange(0, 10)
errorbar(x, y, ybar)
errorbar(x, 2 * y, 0.5 * ybar)
legend([hi , hi2], loc=0)


That gave a AttributeError: LineCollection instance has no attribute
'get_lines'.

I'm running matplotlib on Debian Lenny.  Thanks a lot.

-
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] latex labels on saved plots

2007-09-20 Thread Jordan Atlas
Hello,

I'm having trouble saving eps or pdf versions of plots that have TeX 
labels using matplotlib.  When I try to save an EPS file, I get the message:

...
RuntimeError: ghostscript was not able to process your image.
Here is the full report generated by ghostscript:

(Author's note: No 'report' is actually printed)

When I try to save a PDF file, I get the message:

...
  File 
C:\Python24\Lib\site-packages\matplotlib\backends\backend_pdf.py, line 
1085, in get_canvas_
width_height
return d*self.file.width, d*self.file.height
AttributeError: PdfFile instance has no attribute 'width'

Does anyone have any suggestions for how to fix this?  The TeX 
labels work fine is I save as a PNG file.  I saw an older thread 
(http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg03953.html
 
) that seems to address similar issues, but I don't understand the 
solution (using XPDF distiller).

Thank you for your help,

--Jordan


-
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] how to control space between ylabel and yticklabel?

2007-09-20 Thread jetxee
Wed, 19 Sep 2007 19:58:30 -0400, Cizhong Jiang [EMAIL PROTECTED]:

 I have a long ylabel that is displayed in two lines. Thus, the ylabel
 overlaps with yticklabels. Does anyone know how to control the space between
 ylabel and yticklabel? Thank you very much.
 

This should help:
gca().yaxis.LABELPAD=20 # or the value you like

I had the same problem recently and found the solution here:
http://thread.gmane.org/gmane.comp.python.matplotlib.general/3896/focus=3904

--
jx


-
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] latex labels on saved plots

2007-09-20 Thread Jouni K . Seppänen
Jordan Atlas [EMAIL PROTECTED] writes:

 I'm having trouble saving eps or pdf versions of plots that have
 TeX labels using matplotlib.

Which version of matplotlib are you using? The error message you quote
for the pdf backend shows a line 1085 in get_canvas_width_height, which
is impossible both in the latest released version 0.90.1 and in current
svn. I vaguely remember there being a bug like that quite some time ago.

In any case, no released version of matplotlib supports using TeX with
the pdf backend. Do you mean the (TeX-like) mathtext format parsed by
matplotlib? In current svn there is some support for TeX with the pdf
backend, but it has not (AFAIK) been tested on Windows.

 I saw an older thread 
 (http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg03953.html
  
 ) that seems to address similar issues, but I don't understand the 
 solution (using XPDF distiller).

Gmane mangles the URL (to protect email addresses) so I can't read the
message you cite, but using the XPDF distiller means setting
ps.usedistiller to xpdf in your matplotlibrc file. You will need to have
ps2pdf (from ghostscript) and pdftops (from xpdf or poppler) installed.

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


-
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] plot different columns

2007-09-20 Thread Jouni K . Seppänen
Fabian Braennstroem [EMAIL PROTECTED] writes:

 Jouni K. Seppänen schrieb am 09/16/2007 05:51 PM:
 def myplot(ax, matrix, linestyle, color):
   [...]
 Thanks for your help! add_line seems to be the right
 function... I am not sure yet, if I need your function call,
 but I will check it!?

Oh, I just wrote my suggestion as a myplot function called by a main
program as an example of what you could use instead of the built-in
plot. There are of course many possible ways to organize your program.

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


-
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] Drawing filled circles (discs)

2007-09-20 Thread Jouni K . Seppänen
sidimok [EMAIL PROTECTED] writes:

 Thank you very much indeed for the help, both solutions work like a
 charm. However Dave's one gives rough cirlces, approximated by
 polygones, which is not very accurate for my buisness.

As he said, increasing the number of vertices could be enough, depending
on your exact needs. If you zoom in on polygons, you will of course
eventually see the difference.

 May I ask how to create a circleCollection as Jouni The Expert
 proposed?

I meant that you could read through collections.py and implement a
CircleCollection along the lines of the other collections there. I'm not
quite sure what exactly this entails [so I'm not expert enough to answer
your question :-)]. At least it would mean a new method for backends,
although one that you could implement once in backend_bases.

(Now that I look at collections.py, the base class Collection has a
get_verts method that derived classes should override and that other
parts of matplotlib call, so perhaps collections of non-polygons would
require more extensive changes than just adding a new subclass.)

The advantage would be speed of rendering in case you draw lots of
circles, so if speed is not a problem, don't worry about this.

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


-
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] plot different columns

2007-09-20 Thread Fabian Braennstroem
Hi Jouni,

Jouni K. Seppänen schrieb am 09/20/2007 06:50 PM:
 Fabian Braennstroem [EMAIL PROTECTED] writes:
 
 Jouni K. Seppänen schrieb am 09/16/2007 05:51 PM:
 def myplot(ax, matrix, linestyle, color):
[...]
 Thanks for your help! add_line seems to be the right
 function... I am not sure yet, if I need your function call,
 but I will check it!?
 
 Oh, I just wrote my suggestion as a myplot function called by a main
 program as an example of what you could use instead of the built-in
 plot. There are of course many possible ways to organize your program.
Thanks for your help; I was just a bit confused. I got it now.
Fabian


-
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] Starting troubles with matplotlib.

2007-09-20 Thread Jouni K . Seppänen
Shishir Ramam [EMAIL PROTECTED] writes:

 What I cannot understand is why the vertical bars don't align to the
 y-axis 0 point.

Also if you don't draw some of the green lines, the red ones extend
beyond the x-axis. I wonder if this is an artifact from the subpixel
rendering in Agg and the snap-to-pixel corrections in axis lines...

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


-
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] latex labels on saved plots

2007-09-20 Thread Jordan Atlas
Jouni,

Which version of matplotlib are you using? The error message you quote
for the pdf backend shows a line 1085 in get_canvas_width_height, which
is impossible both in the latest released version 0.90.1 and in current
svn. I vaguely remember there being a bug like that quite some time ago.

  

I apologize for the missing information.  I was using matplotlib 0.90.0 
with python 2.4, and just upgraded to matplotlib 0.90.1 after reading 
your message.  Also, I'm doing this all on winXP.

Now, when I try to save a PDF (with the newer version of matplotlib), I 
get the error:

  File C:\Python24\Lib\site-packages\matplotlib\pylab.py, line 796, in 
savefig
return fig.savefig(*args, **kwargs)
  File C:\Python24\Lib\site-packages\matplotlib\figure.py, line 759, 
in savefig
self.canvas.print_figure(*args, **kwargs)
  File 
C:\Python24\Lib\site-packages\matplotlib\backends\backend_tkagg.py, 
line 187, in print_figu
re
agg.print_figure(filename, dpi, facecolor, edgecolor, orientation,
  File 
C:\Python24\Lib\site-packages\matplotlib\backends\backend_agg.py, line 
497, in print_figure

printfunc(filename, dpi, facecolor, edgecolor, orientation, **kwargs)
  File 
C:\Python24\Lib\site-packages\matplotlib\backends\backend_pdf.py, line 
1393, in print_figur
e
self.figure.draw(renderer)
  File C:\Python24\Lib\site-packages\matplotlib\figure.py, line 601, 
in draw
for a in self.axes: a.draw(renderer)
  File C:\Python24\Lib\site-packages\matplotlib\axes.py, line 1286, in 
draw
a.draw(renderer)
  File C:\Python24\Lib\site-packages\matplotlib\axis.py, line 601, in draw
tick.draw(renderer)
  File C:\Python24\Lib\site-packages\matplotlib\axis.py, line 176, in draw
if self.label1On: self.label1.draw(renderer)
  File C:\Python24\Lib\site-packages\matplotlib\text.py, line 911, in draw
Text.draw(self, renderer)
  File C:\Python24\Lib\site-packages\matplotlib\text.py, line 420, in draw
self._fontproperties, angle)
  File C:\Python24\Lib\site-packages\matplotlib\backend_bases.py, line 
383, in draw_tex
raise NotImplementedError
NotImplementedError

I get the same error as in my original post when trying to save an EPS:

  File C:\Python24\Lib\site-packages\matplotlib\figure.py, line 759, 
in savefig
self.canvas.print_figure(*args, **kwargs)
  File 
C:\Python24\Lib\site-packages\matplotlib\backends\backend_tkagg.py, 
line 187, in print_figu
re
agg.print_figure(filename, dpi, facecolor, edgecolor, orientation,
  File 
C:\Python24\Lib\site-packages\matplotlib\backends\backend_agg.py, line 
497, in print_figure

printfunc(filename, dpi, facecolor, edgecolor, orientation, **kwargs)
  File 
C:\Python24\Lib\site-packages\matplotlib\backends\backend_ps.py, line 
1011, in print_figure

orientation, papertype)
  File 
C:\Python24\Lib\site-packages\matplotlib\backends\backend_ps.py, line 
1247, in _print_figur
e_tex
else: gs_distill(tmpfile, ext=='.eps', ptype=papertype, bbox=bbox)
  File 
C:\Python24\Lib\site-packages\matplotlib\backends\backend_ps.py, line 
1366, in gs_distill
if exit_status: raise RuntimeError('ghostscript was not able to 
process \
RuntimeError: ghostscript was not able to process your image.
Here is the full report generated by ghostscript:


In any case, no released version of matplotlib supports using TeX with
the pdf backend. Do you mean the (TeX-like) mathtext format parsed by
matplotlib? In current svn there is some support for TeX with the pdf
backend, but it has not (AFAIK) been tested on Windows.
  

I guess I mean TeX-like mathtext format parsed by matplotlib.  For 
example, I'm using things like this:

rc('text', usetex=True) 
Plotting.xlabel(r'\textbf{Time (s)}', fontsize=16)

Gmane mangles the URL (to protect email addresses) so I can't read the
message you cite, but using the XPDF distiller means setting
ps.usedistiller to xpdf in your matplotlibrc file. You will need to have
ps2pdf (from ghostscript) and pdftops (from xpdf or poppler) installed.

  


I will look into this immediately.

Thank you,

--Jordan


-
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] Starting troubles with matplotlib.

2007-09-20 Thread Jouni K . Seppänen
Jouni K. Seppänen [EMAIL PROTECTED] writes:

 Shishir Ramam [EMAIL PROTECTED] writes:
 What I cannot understand is why the vertical bars don't align to the
 y-axis 0 point.

 Also if you don't draw some of the green lines, the red ones extend
 beyond the x-axis. I wonder if this is an artifact from the subpixel
 rendering in Agg and the snap-to-pixel corrections in axis lines...

No, it's much simpler: in matplotlibrc there is a setting for
lines.solid_capstyle, and apparently the default is projecting, but
you want butt.

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


-
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] how to control space between ylabel and yticklabel?

2007-09-20 Thread Alan G Isaac
On Thu, 20 Sep 2007, jetxee apparently wrote:
 gca().yaxis.LABELPAD=20 # or the value you like 

This appears to be undocumented?  E.g.,
http://matplotlib.sourceforge.net/matplotlib.axis.html

Cheers,
Alan Isaac




-
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] creating a timeline

2007-09-20 Thread Ryan Krauss
I think I have something I like reasonably well.  Is that attached
timeline fairly intuitive?  I am proposing a project for next summer
that has two main parts.  Each part has three subsections that are
roughly one month long.

Thanks,

Ryan

On 9/20/07, Ryan Krauss [EMAIL PROTECTED] wrote:
 I am really just getting to mess with this now and ran into an issue.
 I want to turn off the y axis and 3 sides of the border around the
 plot area, so that I left with just the bottom x-axis and its tick
 marks.  Turning off the y axis is easy enough, but the only way I
 found to get rid of the border is with

 ax.set_frame_on(False)

 which also gets rid of my bottom x axis and leaves tick marks along
 the top (see attached).  How do I get rid of the top tick marks, keep
 the bottom ones, and get the bottom x-axis back?

 Thanks,

 Ryan

 On 9/20/07, Ryan Krauss [EMAIL PROTECTED] wrote:
  bling-bling.  I know it is eye candy and in questionable taste, but I
  think it fits my non-technical audience in this case.  I think this is
  enough to get me going.  Thanks John.
 
  Ryan
 
  On 9/20/07, John Hunter [EMAIL PROTECTED] wrote:
   On 9/20/07, Ryan Krauss [EMAIL PROTECTED] wrote:
I would need to create a timeline for a Latex document (eps output).
There may be other tools besides Matplotlib and I am open to
suggestions.  But I were going to use mpl, what would it take to do
something along these lines:
http://www.timelinemaker.com/product-samplecharts-constructiontimeline.html
   
Basically, I would need a nicely formatted dates along the x-axis and
then lightly colored rectangles with text in them.  The width would
show when I anticipate some part of the project starting and ending.
The y coordinate of the rectangle would used to allow project portions
to overlap.  It would be nice but not essential if the rectangles had
a little fade in and out in their back ground color instead of a solid
color, but that is not essential.
   
Is there a clean way to do this with mpl?
  
   See examples/broken_barh.py (this also allows breaks in the horizontal
   bars, eg if an event is interrupted and then resumes).  I haven't
   added gradient fills on bars because I don't think they convey little
   if any information but just add to the glitz factor (an example of
   chart junk to use Tufte's phrase) but at some point we should bow to
   popular pressure and add it.  Actually, you can hack gradient filled
   bars and axes backgrounds -- be careful, viewing the figure below may
   induce seizures.
  
   from pylab import figure, show, nx, cm
  
   def gbar(ax, x, y, width=0.5, bottom=0):
  X = [[.6, .6],[.7,.7]]
  for left,top in zip(x, y):
  right = left+width
  ax.imshow(X, interpolation='bicubic', cmap=cm.Blues,
extent=(left, right, bottom, top), alpha=1)
  
   fig = figure()
  
   xmin, xmax = xlim = 0,10
   ymin, ymax = ylim = 0,1
   ax = fig.add_subplot(111, xlim=xlim, ylim=ylim,
   autoscale_on=False)
   X = [[.6, .6],[.7,.7]]
  
   ax.imshow(X, interpolation='bicubic', cmap=cm.copper,
extent=(xmin, xmax, ymin, ymax), alpha=1)
  
   N = 10
   x = nx.arange(N)+0.25
   y = nx.mlab.rand(N)
   gbar(ax, x, y, width=0.7)
   ax.set_aspect('normal')
   show()
  
   -
   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
  
 


attachment: timeline.png-
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