[Matplotlib-users] Percentage in pie in e.g. white instead of black

2009-08-21 Thread Werner F. Bruhin
I would like to have the percentage values shown in white instead of in 
black within a pie chart.

I figured I could do something like:

def reColor(percent):
"I am lost here on how to format the percentage and change 
the color"

axes.pie(values, labels=labels, autopct=reColor, shadow=False, 
colors=colors)

I thought I could use a mpl.text.Text but I only get the percentage in 
"reColor".

Looked at the gallery and tried to based it on the "barchart_demo2.py" 
example without success.  Although would prefer not to have to loop 
through the text.Text instances and figure out which ones are a 
percentage and then color them - but I guess that would be one way of 
doing it but it looks a bit odd to me.

Thanks for any tips
Werner




--
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] Custom ticklabels on colorbar

2009-08-21 Thread Scott Sinclair
> 2009/8/21 Daniel Platz :
> I just realized that I did not give the correct plot object when creating
> the colorbar. Now it works perfectly to pass arguments by set_xticklabels().
>
> However, another question just arose. To format the numbers on the tick
> labels I tried to pass a format string when creating the colorbar with the
> format parameter. But it has no effect. The same when I give a
> FormatStrFormatter object. I also tried to use
> cb.ax.axis.set_major_formatter(). The effect of this was. That it sets the
> labels to the range between 0 and 1. Is there a solution for this problem
> besides entering the tick labels manually?

> Scott Sinclair wrote:
>>>
>>> 2009/8/20 Daniel Platz :
>>> The setting of the new ticklabels works now. But the first label is
>>> attached to the second tick. I tried to adapt the clim range by using
>>> the vmin and vmax option of pcolor but it did not help.
>>
>> Does this help?
>>
>>
>> http://matplotlib.sourceforge.net/examples/pylab_examples/colorbar_tick_labelling_demo.html

Hi Daniel,

It's hard for me to see what's happening here without a simple
standalone code example to illustrate your problem. Trying to
reproduce what you're seeing with a simple example will often reveal
where you're going wrong..

Also note that the default on this mailing list is not to send replies
to the list. Please use "Reply to all" so that your response goes to
the entire list and not directly to me, you're more likely to get a
helpful response that way. I'm sending this to the list, hopefully
someone can help you to resolve the issue.

Cheers,
Scott

--
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] Custom ticklabels on colorbar

2009-08-21 Thread Jae-Joon Lee
On Fri, Aug 21, 2009 at 10:01 AM, Scott
Sinclair wrote:
>> I just realized that I did not give the correct plot object when creating
>> the colorbar. Now it works perfectly to pass arguments by set_xticklabels().
>>
>> However, another question just arose. To format the numbers on the tick
>> labels I tried to pass a format string when creating the colorbar with the
>> format parameter. But it has no effect. The same when I give a
>> FormatStrFormatter object. I also tried to use
>> cb.ax.axis.set_major_formatter(). The effect of this was. That it sets the
>> labels to the range between 0 and 1. Is there a solution for this problem
>> besides entering the tick labels manually?

The tick locator and tick formatter needs to be passed during the
colorbar creation. Otherwise,
it gets very tricky to deal with. This is because the data coordinate
of the colorbar axes is not directly associated with the ticklabels.

If passing the formatter during the colorbar creation has no effect,
this should be filed as a bug. Please post a small standalone example
that reproduces your problem. Also, please report your version of
matplotlib. If you're using older version, I recommend you to test it
with newer version.

Just in case, my quick test worked fine.

imshow([[1,2],[2,3]])
cb=colorbar(format=r"$%2.1f\%%$")

-JJ

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


[Matplotlib-users] Newbie problem using csv2rec

2009-08-21 Thread Phil Robare
Hi folks,

I have a (newbie) problem using csv2rec.  I am a regular python user
but this is my first time using matplotlib and numpy after being
inspired by attending a talk by Dr. John Hunter.

I am trying to read a csv file that has >6000 lines that look like this:


8/17/2009,4:49:52
PM,CVAgent,Information,5,537,N/A,THP-PR-APVL,F:20090210::7881558:3893255:311247:166422::,Completed..
8/17/2009,4:49:52
PM,CVAgent,Information,3,537,N/A,THP-PR-APVL,F:20090210::7881558:3888955:311247:166422::,From
Disk..
8/17/2009,4:49:51 PM,CVAgent,Warning,8,556,N/A,THP-PR-APVL,Exception
in CVProcess.GetNewfile: The process cannot access the file because it
is being used by another process..,
8/17/2009,4:49:51 PM,CVAgent,Information,2,447,N/A,THP-PR-APVL,SDAY ->
R:20090210:::3893955:311247:166422::20090210:::3893955:388247:166422::50:,.
8/17/2009,4:29:55
PM,CVAgent,Information,5,537,N/A,THP-PR-APVL,F:20090728::7881558:4888461:22088980:964878::,Completed..
8/17/2009,4:29:55
PM,CVAgent,Information,3,537,N/A,THP-PR-APVL,F:20090728::7881558:4888461:22030980:964878::,From
Disk..
8/17/2009,4:29:54 PM,CVAgent,Information,2,3045,N/A,THP-PR-APVL,JJULIO
-> 
R:20090728:::4888461:22030980:964878::20090728:::4888461:22030980:964878::50:,.
8/17/2009,4:24:02
PM,CVAgent,Information,5,537,N/A,THP-PR-APVL,F:20090226::7881558:2882501:325032:316888::,Completed..
8/17/2009,4:24:02
PM,CVAgent,Information,3,537,N/A,THP-PR-APVL,F:20090226::7881558:8822501:325882:318816::,From
Disk..
8/17/2009,4:23:56 PM,CVAgent,Information,2,556,N/A,THP-PR-APVL,tdietz
-> R:20090226325882:318816::20090226325882:318816::50:,.
8/17/2009,4:21:41 PM,CVAgent,Information,2,3045,N/A,THP-PR-APVL,tdietz
-> R:20090226325882:318816::20090226325032:318816::50:,.
8/17/2009,4:19:44
PM,CVAgent,Information,5,537,N/A,THP-PR-APVL,F:20090210::7881558:2882613:278887:402::,Completed..
8/17/2009,4:19:43
PM,CVAgent,Information,3,537,N/A,THP-PR-APVL,F:20090210::7881558:2882613:278777:402::,From
Disk..
8/17/2009,4:19:42 PM,CVAgent,Information,2,793,N/A,THP-PR-APVL,MUTSCH
-> R:20090210:::2882613:278887:402::20090210:::2882613:278887:402::50:,.
8/17/2009,4:11:02
PM,CVAgent,Information,5,793,N/A,THP-PR-APVL,F:20090817::7881558:1776517:1211:58800::,Completed..
8/17/2009,4:49:52
PM,CVAgent,Information,5,537,N/A,THP-PR-APVL,F:20090210::7881558:3893255:311247:166422::,Completed..


I have given the columns names since there is not a header line:

In [150]: print names
('date', 'time', 'program', 'level', 'error_id', 'thread', 'na',
'machine', 'request', 'detail')


and I have provided convert functions to be sure the data is read correctly:

In [152]: print converterd
{'thread': , 'level': , 'na': ,
'request': , 'detail': , 'machine': , 'program': , 'time': , 'date': }


(I'm not sure if this is needed.  IPython seems to recognize csv2rec
just fine but the sample program does an import like this.)

In [141]: import matplotlib.mlab as mlab


So now I call csv2rec on my file.  It takes a second or so to gulp it
all in and then returns without error.

In [142]: r=mlab.csv2rec(filename,converterd=converterd,names=names)


So now I look to see what I have.  And it's nothing like I thought it
would be. I expected thousands of records and I have 10.  I expected
times and dates, ints and strings.  And all I have are masked values.

In [143]: r
Out[143]:
masked_records(
       date : [-- -- -- -- -- -- -- -- -- --]
       time : [-- -- -- -- -- -- -- -- -- --]
    program : [-- -- -- -- -- -- -- -- -- --]
      level : [-- -- -- -- -- -- -- -- -- --]
   error_id : [-- -- -- -- -- -- -- -- -- --]
     thread : [-- -- -- -- -- -- -- -- -- --]
         na : [-- -- -- -- -- -- -- -- -- --]
    machine : [-- -- -- -- -- -- -- -- -- --]
    request : [-- -- -- -- -- -- -- -- -- --]
     detail : [-- -- -- -- -- -- -- -- -- --]
   fill_value : ('?', '?', '?', '?', '?', '?', '?', '?', '?', '?')
             )


So I look at the mask.  I see no clues here.

In [144]: r.mask
Out[144]:
array([(True, True, True, True, True, True, True, True, True, True),
      (True, True, True, True, True, True, True, True, True, True),
      (True, True, True, True, True, True, True, True, True, True),
      (True, True, True, True, True, True, True, True, True, True),
      (True, True, True, True, True, True, True, True, True, True),
      (True, True, True, True, True, True, True, True, True, True),
      (True, True, True, True, True, True, True, True, True, True),
      (True, True, True, True, True, True, True, True, True, True),
      (True, True, True, True, True, True, True, True, True, True),
      (True, True, True, True, True, True, True, True, True, True)],
     dtype=[('date', '|b1'), ('time', '|b1'), ('program', '|b1'),
('level', '|b1'), ('error_id', '|b1'), ('thread', '|b1'), ('na',
'|b1'), ('machine', '|b1'),
('request', '|b1'), ('detail', '|b1')])


Well, maybe if I change the mask I can see what is being hidden.

In [145]: r.mask[0]
Out[145]: (True, True, True, True, True, True, Tr

Re: [Matplotlib-users] Newbie problem using csv2rec

2009-08-21 Thread John Hunter
On Fri, Aug 21, 2009 at 11:27 AM, Phil Robare wrote:

> I have a (newbie) problem using csv2rec.  I am a regular python user
> but this is my first time using matplotlib and numpy after being
> inspired by attending a talk by Dr. John Hunter.
>
> I am trying to read a csv file that has >6000 lines that look like this:

Are you able to post your file somewhere -- publicly if possible (eg
attach it to your response)  but offlist if it contains info you would
not like to disseminate widely?

JDH

--
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] Newbie problem using csv2rec

2009-08-21 Thread Chloe Lewis
The sixteen lines of data you sent work in a little histogram- 
generator for me, ignoring the masking (as a nearly-newbie, I can say  
that ignoring the stuff I don't yet care about usually works):

from matplotlib.mlab import csv2rec, csv
import pylab as p
import numpy as n
names = ('date', 'time', 'program', 'level', 'error_id', 'thread',  
'na', 'machine', 'request', 'detail')
r = csv2rec("/Users/clew/Documents/pycode/test.csv", names = names)
print r.shape
print r[3]
for name in names:
 print 'Values of ', name, ':'
 print r[name]

for row in r:
 if row['thread'] == 537: print row

print type(r['thread'])

n, bins, patches = p.hist(r['thread'])
print n,bins,patches
p.savefig('csvhistogram')
p.show()


Does this work for you? On the whole file?

&C

On Aug 21, 2009, at 9:27 AM, Phil Robare wrote:

> Hi folks,
>
> I have a (newbie) problem using csv2rec.  I am a regular python user
> but this is my first time using matplotlib and numpy after being
> inspired by attending a talk by Dr. John Hunter.
>
> I am trying to read a csv file that has >6000 lines that look like  
> this:
>
> 
> 8/17/2009,4:49:52
> PM,CVAgent,Information,5,537,N/A,THP-PR-APVL,F: 
> 20090210::7881558:3893255:311247:166422::,Completed..
> 8/17/2009,4:49:52
> PM,CVAgent,Information,3,537,N/A,THP-PR-APVL,F: 
> 20090210::7881558:3888955:311247:166422::,From
> Disk..
> 8/17/2009,4:49:51 PM,CVAgent,Warning,8,556,N/A,THP-PR-APVL,Exception
> in CVProcess.GetNewfile: The process cannot access the file because it
> is being used by another process..,
> 8/17/2009,4:49:51 PM,CVAgent,Information,2,447,N/A,THP-PR-APVL,SDAY ->
> R: 
> 20090210 
> :::3893955:311247:166422::20090210:::3893955:388247:166422::50:,.
> 8/17/2009,4:29:55
> PM,CVAgent,Information,5,537,N/A,THP-PR-APVL,F: 
> 20090728::7881558:4888461:22088980:964878::,Completed..
> 8/17/2009,4:29:55
> PM,CVAgent,Information,3,537,N/A,THP-PR-APVL,F: 
> 20090728::7881558:4888461:22030980:964878::,From
> Disk..
> 8/17/2009,4:29:54 PM,CVAgent,Information,2,3045,N/A,THP-PR-APVL,JJULIO
> -> R: 
> 20090728 
> :::4888461:22030980:964878::20090728:::4888461:22030980:964878::50:,.
> 8/17/2009,4:24:02
> PM,CVAgent,Information,5,537,N/A,THP-PR-APVL,F: 
> 20090226::7881558:2882501:325032:316888::,Completed..
> 8/17/2009,4:24:02
> PM,CVAgent,Information,3,537,N/A,THP-PR-APVL,F: 
> 20090226::7881558:8822501:325882:318816::,From
> Disk..
> 8/17/2009,4:23:56 PM,CVAgent,Information,2,556,N/A,THP-PR-APVL,tdietz
> -> R:20090226325882:318816::20090226325882:318816::50:,.
> 8/17/2009,4:21:41 PM,CVAgent,Information,2,3045,N/A,THP-PR-APVL,tdietz
> -> R:20090226325882:318816::20090226325032:318816::50:,.
> 8/17/2009,4:19:44
> PM,CVAgent,Information,5,537,N/A,THP-PR-APVL,F: 
> 20090210::7881558:2882613:278887:402::,Completed..
> 8/17/2009,4:19:43
> PM,CVAgent,Information,3,537,N/A,THP-PR-APVL,F: 
> 20090210::7881558:2882613:278777:402::,From
> Disk..
> 8/17/2009,4:19:42 PM,CVAgent,Information,2,793,N/A,THP-PR-APVL,MUTSCH
> -> R: 
> 20090210 
> :::2882613:278887:402::20090210:::2882613:278887:402::50:,.
> 8/17/2009,4:11:02
> PM,CVAgent,Information,5,793,N/A,THP-PR-APVL,F: 
> 20090817::7881558:1776517:1211:58800::,Completed..
> 8/17/2009,4:49:52
> PM,CVAgent,Information,5,537,N/A,THP-PR-APVL,F: 
> 20090210::7881558:3893255:311247:166422::,Completed..
> 
>
> I have given the columns names since there is not a header line:
> 
> In [150]: print names
> ('date', 'time', 'program', 'level', 'error_id', 'thread', 'na',
> 'machine', 'request', 'detail')
> 
>
> and I have provided convert functions to be sure the data is read  
> correctly:
> 
> In [152]: print converterd
> {'thread': , 'level': , 'na': ,
> 'request': , 'detail': , 'machine':  'str'>, 'program': , 'time':  0x03795530>, 'date':  0x037950B0>}
> 
>
> (I'm not sure if this is needed.  IPython seems to recognize csv2rec
> just fine but the sample program does an import like this.)
> 
> In [141]: import matplotlib.mlab as mlab
> 
>
> So now I call csv2rec on my file.  It takes a second or so to gulp it
> all in and then returns without error.
> 
> In [142]: r=mlab.csv2rec(filename,converterd=converterd,names=names)
> 
>
> So now I look to see what I have.  And it's nothing like I thought it
> would be. I expected thousands of records and I have 10.  I expected
> times and dates, ints and strings.  And all I have are masked values.
> 
> In [143]: r
> Out[143]:
> masked_records(
>date : [-- -- -- -- -- -- -- -- -- --]
>time : [-- -- -- -- -- -- -- -- -- --]
> program : [-- -- -- -- -- -- -- -- -- --]
>   level : [-- -- -- -- -- -- -- -- -- --]
>error_id : [-- -- -- -- -- -- -- -- -- --]
>  thread : [-- -- -- -- -- -- -- -- -- --]
>  na : [-- -- -- -- -- -- -- -- -- --]
> machine : [-- -- -- -- -- -- -- -- -- --]
> request : [-- -- -- -- -- -- -- -- -- --]
>  detail : [-- -- -- -- -- -- -- -- -- --]
>fill_value : ('?', '?', '?', '?', '?', '?', '?', '?', '?', '?')
>

[Matplotlib-users] Contour of Number of Occurences in a Scatter Plot

2009-08-21 Thread mkoss

Does anyone know how to do a contour plot of a set of X,Y data where each
contour level has the same number of data points inside it?  What I want to
show is where most of the data is appearing in the x, y position for a
scatter plot of ~1,000 points, so you can't just plot all those as points. 
This is similar to the probability density function for a scatter plot. 

In concept, you would start at the median of x and median of y and then
include points by their distance from the median until you reach the number
in each contour and draw a contour around this region.  Then you would
proceed outward from the contour to find more points.

An alternative, but not exactly correct approach I have already done is to
bin the data like a 2D histogram and then use the number of occurrences in
each bin as the z value for contourf.

I see this plot a lot in the scientific literature, so I know it must be
possible, but haven't been able to find it on the web for python.

Thanks,
Mike
-- 
View this message in context: 
http://www.nabble.com/Contour-of-Number-of-Occurences-in-a-Scatter-Plot-tp25083681p25083681.html
Sent from the matplotlib - users mailing list archive at Nabble.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


[Matplotlib-users] help needed in plotting curved elements

2009-08-21 Thread Sameer Regmi
We are working on plotting mesh (in hermes2d:
http://hpfem.math.unr.edu/projects/hermes2d-new/) We created a python
function to plot mesh but initially without curves. Later we also tried to
work on curved elements but we are having some problems.
In the hermes2d examples curves are defined as [4, 7, 45] where 4,7
are vertices indices, and 45 is center angle.

But in matplotlib we do not see any function to plot curve with these data,
we have to convert them into something more useful to those functions
available in matplotlib. For ex:

1) matplot.path porvides a way to plot curve with three points
http://matplotlib.sourceforge.net/api/path_api.html#module-matplotlib.path

 p1 -> starting Point
 p2 -> control point
 p3 -> end point

 iI we want to go this way we do have p1 & p3 but have to calclate p2
(control point)

2) matplot.patch.arc provides a way to plot an arc

http://matplotlib.sourceforge.net/api/artist_api.html#module-matplotlib.patches

 but it needs
 -> center of circle
 -> start angle
 -> end angle
 -> radius of circle
   we have to calculate all these with data available to us

We didn't find other ways of plotting curves using matplotlib...and in our
view method 1 is the best way for us because currently we have implemented
matplotlib.path to draw mesh without curves, and it will be easy to  fill
color this way.

We tried the method 1 but the result was a garbled mesh. I would appreciate
if anybody could guide us how we can use the matplotlib functions to draw
curved elements if we are given information as described above.
Thanks
--
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


[Matplotlib-users] introductory backends

2009-08-21 Thread Michael Cohen
Hi all,
At the Scipy2009 conference I was recently told I could get better 
performance from matplotlib through an ssh tunnel by using a different 
backend.  However, I can't find any introductory material on this, just 
function docs for backend_bases module.  What part of the matplotlib 
call includes backend specification?  What backends work well for ssh 
tunnels?

Cheers,
Mike

--
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] introductory backends

2009-08-21 Thread John Hunter
On Fri, Aug 21, 2009 at 6:44 PM, Michael Cohen wrote:
> Hi all,
> At the Scipy2009 conference I was recently told I could get better
> performance from matplotlib through an ssh tunnel by using a different
> backend.  However, I can't find any introductory material on this, just
> function docs for backend_bases module.  What part of the matplotlib
> call includes backend specification?  What backends work well for ssh
> tunnels?

GTK and WX should work best working over ssh, and I think GTKCairo,
since these should send the drawing commands over X11 rather than the
entire raster which the *Agg backends send.  We should put this in the
backends FAQ, but for now there is some additional relevant info
there:

http://matplotlib.sourceforge.net/faq/installing_faq.html#backends

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


[Matplotlib-users] FIFOBuffer calls BBox.update, not a method

2009-08-21 Thread Ryanitus

Hello.

I was doing a simple test using a FIFOBuffer.  I set the dataLim parameter
to the dataLim of a Line2D plot.  After adding a value to the FIFO, it
raises an exception.  It looks like the FIFO is trying to call
Bbox.update(), but that method does not exist.  Other update_*() methods do. 
Any ideas?

Here's a snippet:

import matplotlib.pyplot as plt
from matplotlib.mlab import FIFOBuffer as FIFO

f = FIFO(100) 
p = plt.plot([0,1,2],[0,1,2])
f.dataLim = p[0].get_axes().dataLim
plt.draw()

f.add(3,3)

Here's the exception:

Traceback (most recent call last):
  File "C:\fifo.py", line 9, in 
f.add(3,3)
  File "C:\Python26\lib\site-packages\matplotlib\mlab.py", line 1103, in add
self.dataLim.update(xys, -1) #-1 means use the default ignore setting
AttributeError: 'Bbox' object has no attribute 'update'

-- 
View this message in context: 
http://www.nabble.com/FIFOBuffer-calls-BBox.update%2C-not-a-method-tp25088821p25088821.html
Sent from the matplotlib - users mailing list archive at Nabble.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


[Matplotlib-users] per-element marker - possible? how to?

2009-08-21 Thread John Owens
So I can do:

plot([1,2,3], [1,4,9], marker='+')

and it'll draw 3 points each with a + marker.

What I'd really like to do is

plot([1,2,3], [1,4,9], markerlist=['A', 'B', 'C'])

and have it draw the first point with a rendered
letter 'A', the second with a 'B', and the third with
a 'C'. 

1) Not sure how to draw a letter as my marker - are 
   markers limited to those in the marker list? Is that
   possible?

2) And is it possible to have a different marker for each
   point in a dataset, specified by a vector? I guess I
   could draw a separate plot for each point, but that's
   an enormous kludge.

JDO



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


[Matplotlib-users] FYI, typo

2009-08-21 Thread marc desmarais
This sentence is missing "to" or "and" I think:

"These helper methods will take your data (eg. numpy arrays and strings) create 
primitive ...

Is in at http://matplotlib.sourceforge.net/users/artists.html

Marc Desmarais

Long Beach, CA



  --
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] FYI, typo

2009-08-21 Thread Nicolas Pinto
Hey guys,

I found another typo here:

http://matplotlib.sourceforge.net/api/axes_api.html?highlight=legend#matplotlib.axes.Axes.get_legend_handles_labels

-equibalent
+equivalent

Cheers,

N

On Fri, Aug 21, 2009 at 8:29 PM, marc desmarais  wrote:

> This sentence is missing "to" or "and" I think:
>
> "These helper methods will take your data (eg. numpy arrays and strings)
> create primitive ...
>
> Is in at http://matplotlib.sourceforge.net/users/artists.html
>
> Marc Desmarais
> Long Beach, CA
>
>
>
> --
> 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
>
>


-- 
Nicolas Pinto
Ph.D. Candidate, Brain & Computer Sciences
Massachusetts Institute of Technology, USA
http://web.mit.edu/pinto
--
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] Contour Plotting of Varied Data on a Shape

2009-08-21 Thread Christopher Barker
Erik Schweller wrote:
> My overall goal is to generate contour plots for a wide range of input
> data.  The data points are not regularly spaced and do not align to
> any grid.  The data points represent measurements taken from a model
> that can take on a variety of shapes.  To make matters more difficult,
> I'd prefer not to interpolate around corners of the model.

It strikes me that when you are working with unstructured data like 
this, it may be better to keep it unstrucured -- do the delanauy 
triangulation and directly contour from that. It's actually prety easy 
to contour a triangular mesh.

Unfortunately, I haven't see code to do it in scipy or MPL. Am I wrong? 
Is there something there. If not, there really should be it seems a bit 
silly to shoehorn your data to a rectangular grid just to contour it.

I suppose NN interpolation is essentially doing this already, but it 
introduces issues with a boundary that doesnt' line up to a rectangular 
grid.

As I think about it, I'm going to have to write code to do this (contour 
an unstructured triangular mesh) sometime soon, so please let me know if 
it does exist already -- if not I'll try to remember to contribute it 
when I get around to it.

-Chris

-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

chris.bar...@noaa.gov

--
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] per-element marker - possible? how to?

2009-08-21 Thread Jouni K . Seppänen
John Owens  writes:

> plot([1,2,3], [1,4,9], markerlist=['A', 'B', 'C'])
>
> and have it draw the first point with a rendered
> letter 'A', the second with a 'B', and the third with
> a 'C'. 

You could do

text(1,1,'A')
text(2,4,'B')
text(3,9,'C')

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


--
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] show() problem in Mac OS X 10.5.8

2009-08-21 Thread Michiel de Hoon
Does anybody know why the show._needmain stuff is needed in the show() function 
in backend_tkagg.py? Currently, this function is as follows:

def show():
"""
Show all the figures and enter the gtk mainloop

This should be the last line of your script.  This function sets
interactive mode to True, as detailed on
http://matplotlib.sf.net/interactive.html
"""
for manager in Gcf.get_all_fig_managers():
manager.show()
import matplotlib
matplotlib.interactive(True)
if rcParams['tk.pythoninspect']:
os.environ['PYTHONINSPECT'] = '1'
if show._needmain:
Tk.mainloop()
show._needmain = False
show._needmain = True


If I remove the show._needmain stuff, as in:

def show():
"""
Show all the figures and enter the gtk mainloop

This should be the last line of your script.  This function sets
interactive mode to True, as detailed on
http://matplotlib.sf.net/interactive.html
"""
for manager in Gcf.get_all_fig_managers():
manager.show()
import matplotlib
matplotlib.interactive(True)
if rcParams['tk.pythoninspect']:
os.environ['PYTHONINSPECT'] = '1'
Tk.mainloop()

then the function still seems to work fine, and multiple show()s also works.

--Michiel.


--- On Thu, 8/20/09, Kim, Dae-Won  wrote:

> From: Kim, Dae-Won 
> Subject: Re: [Matplotlib-users] show() problem in Mac OS X 10.5.8
> To: "Michiel de Hoon" 
> Cc: "Ryan May" , matplotlib-users@lists.sourceforge.net
> Date: Thursday, August 20, 2009, 10:26 AM
> 
> I tested with TKAgg and WXAgg. I just bought macbook and
> I'm newbie yet. Do I need to set something special for
> the multiple show()s?
> 
> Thanks,
> 
> -Dae-Won
> 
> On Thu, Aug 20, 2009 at 10:01 AM,
> Michiel de Hoon 
> wrote:
> 
> 
> Whether or not you can do multiple
> show()s depends on which backend you use. For example, the
> Mac OS X native backend has no problems with the multiple
> show()s in your example. Which backend were you using? While
> matplotlib does not support multiple show()s in general,
> there may be a simple solution to get that working for the
> backend you are using.
> 
> 
> 
> 
> 
> --Michiel.
> 
> 
> 
> --- On Wed, 8/19/09, Kim, Dae-Won 
> wrote:
> 
> 
> 
> > From: Kim, Dae-Won 
> 
> > Subject: Re: [Matplotlib-users] show() problem in Mac
> OS X 10.5.8
> 
> > To: "Ryan May" 
> 
> > Cc: matplotlib-users@lists.sourceforge.net
> 
> > Date: Wednesday, August 19, 2009, 2:48 PM
> 
> >
> 
> >  The one 'preliminary' solution I found is
> using
> 
> > an interactive mode + raw_input.
> 
> > Here is and example,
> 
> >
> 
> >     ion()
> 
> >     plot([1,2,3,4,5])
> 
> >     raw_input('Type Enter')
> 
> >     clf()
> 
> >
> 
> >
> 
> >     plot([1,2,3,4,5])
> 
> >     raw_input('Type_Enter')
> 
> >     clf()
> 
> >     plot([1,2,3,4,5])
> 
> >     show()
> 
> >
> 
> > With this approach, I can press the enter when I want
> to
> 
> > see next figure.
> 
> >
> 
> >
> 
> >
> 
> > Though It's not as convenient as 'multiple
> 
> > show()'..
> 
> >
> 
> >
> 
> > On Wed, Aug 19, 2009 at 1:57 PM,
> 
> > Kim, Dae-Won 
> 
> > wrote:
> 
> >
> 
> >
> 
> >
> 
> >
> 
> > On Wed, Aug 19, 2009 at 1:02 PM,
> 
> > Ryan May 
> 
> > wrote:
> 
> >
> 
> >
> 
> >
> 
> > On Wed, Aug 19, 2009 at 11:55
> 
> > AM, coati 
> 
> > wrote:
> 
> >
> 
> >
> 
> >
> 
> >
> 
> >
> 
> >
> 
> >
> 
> >  I have a problem with show() command in my macbook
> 
> > machine (Leopard 10.5.8).
> 
> >
> 
> > For example, if I run the script shown below
> 
> >
> 
> > (let assume it is saved as 'test.py', and I
> run a
> 
> > command 'python test.py'),
> 
> >
> 
> >
> 
> >
> 
> > ---
> 
> >
> 
> >
> 
> >
> 
> > plot([1,2,3,4,5])
> 
> >
> 
> > show() #first window
> 
> >
> 
> > plot([1,2,3,4,5])
> 
> >
> 
> > show() #second window
> 
> >
> 
> > plot([1,2,3,4,5])
> 
> >
> 
> > show() #third window
> 
> >
> 
> >
> 
> >
> 
> > ---
> 
> >
> 
> >
> 
> >
> 
> > Then the first window just pops up and I can see a
> 
> > beautiful straight line
> 
> >
> 
> > :) No problem so far.
> 
> >
> 
> > But, after I close the first window by clicking the
> close
> 
> > button of the
> 
> >
> 
> > window,
> 
> >
> 
> > other two window (second and third) just pops up and
> close
> 
> > themselves
> 
> >
> 
> > instantly
> 
> >
> 
> > even though I didn't click the close button...
> 
> >
> 
> > Also, the second and third plot is shown in the same
> 
> > window.
> 
> >
> 
> >
> 
> >
> 
> > I don't have such problem in my Ubuntu machine..
> 
> >
> 
> >
> 
> >
> 
> > Does anybody know reasons?
> 
> > show() actually handles starting the GUI mainloop, so
> you
> 
> > really shouldn't be calling it more than once from
> a
> 
> > script.  Quite frankly, it's more amazing that it
> works
> 
> > on your Ubuntu macine. :)  If you're wanting 3
> separate
> 
> > windows, try:
> 
> >
> 
> >
> 
> >
> 
> >
> 
> >
> 
> >
> 
> > plot([1,2,3,4