[Matplotlib-users] scipy, matplotlib import errors

2008-03-27 Thread John
Hello, could someone please help me understand a strange problem, possibly
associated with PYTHONPATH. When I import matplotlib, pylab, or scipy from
any directory other than the root installation directory, it fails. However,
if I'm in the python installation directory there are no errors. Thanks in
advance! Please see below:

[EMAIL PROTECTED] ~]$ python*
Python 2.5.1 (r251:54863, Mar  7 2008, 04:10:12)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.5/site-packages/scipy/__init__.py", line 18, in

import pkg_resources as _pr # activate namespace packages (manipulates
__path__)
  File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 2581, in

add_activation_listener(lambda dist: dist.activate())
  File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 640, in
subscribe
callback(dist)
  File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 2581, in

add_activation_listener(lambda dist: dist.activate())
  File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 2130, in
activate
map(declare_namespace, self._get_metadata('namespace_packages.txt'))
  File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 1749, in
declare_namespace
_handle_ns(packageName, path_item)
  File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 1712, in
_handle_ns
module = sys.modules[packageName] = new.module(packageName)
AttributeError: 'module' object has no attribute 'module'
>>>
[EMAIL PROTECTED] ~]$ cd /usr/lib/python2.5/
[EMAIL PROTECTED] python2.5]$ python*
Python 2.5.1 (r251:54863, Mar  7 2008, 04:10:12)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy
>>>
[EMAIL PROTECTED] python2.5]$ cd
[EMAIL PROTECTED] ~]$ echo $PYTHONPATH*
:.:/usr/lib/python2.5/:.:/home/jfb/bin
[EMAIL PROTECTED] ~]$*
-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Zero length quiver/savefig bug

2008-03-27 Thread Andrew Charles
Quiver doesn't seem to be able to handle begin passed zeros for the
vector lengths. The full error output is below. I'm running Leopard
with macpython 2.5.2 using
matplotlib-0.91.2-py2.5-macosx-10.3-i386.egg

The following code does not work:

rx = numpy.array([0.0,0.0])
ry = numpy.array([1.0,-1.0])
ax = numpy.array([0.0,0.0])
ay = numpy.array([0.0,0.0])

quiver(rx,ry,ax,ay)
savefig("image2.png",format='png')

The same code works if any of ax or ay are nonzero.


Cheers,

Andrew Charles

---

Error output:

spinode: ./test_case.py
Traceback (most recent call last):
  File "./test_case.py", line 24, in 
savefig("image2.png",format='png')
  File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.3-i386.egg/matplotlib/pyplot.py",
line 269, in savefig
return fig.savefig(*args, **kwargs)
  File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.3-i386.egg/matplotlib/figure.py",
line 782, in savefig
self.canvas.print_figure(*args, **kwargs)
  File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.3-i386.egg/matplotlib/backends/backend_wxagg.py",
line 101, in print_figure
FigureCanvasAgg.print_figure(self, filename, *args, **kwargs)
  File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.3-i386.egg/matplotlib/backend_bases.py",
line 1201, in print_figure
self.figure.canvas.draw()
  File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.3-i386.egg/matplotlib/backends/backend_wxagg.py",
line 61, in draw
FigureCanvasAgg.draw(self)
  File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.3-i386.egg/matplotlib/backends/backend_agg.py",
line 358, in draw
self.figure.draw(self.renderer)
  File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.3-i386.egg/matplotlib/figure.py",
line 624, in draw
for a in self.axes: a.draw(renderer)
  File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.3-i386.egg/matplotlib/axes.py",
line 1345, in draw
a.draw(renderer)
  File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.3-i386.egg/matplotlib/quiver.py",
line 336, in draw
verts = self._make_verts(self.U, self.V)
  File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.3-i386.egg/matplotlib/quiver.py",
line 386, in _make_verts
length = a/(self.scale*self.width)
  File "/Library/Python/2.5/site-packages/numpy/ma/core.py", line
1679, in __div__
return divide(self, other)
  File "/Library/Python/2.5/site-packages/numpy/ma/core.py", line 614,
in __call__
numpy.putmask(d2, t, self.filly)


test_case.py
Description: Binary data
-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [Pythonmac-SIG] py2app and matplotlib

2008-03-27 Thread Christopher Barker
Ronald Oussoren wrote:
> That load command is for LC_UUID. The version of macholib in subversion 
> should have some support that is (basicly ignoring the entire load 
> command because macholib won't have to change it), could you test that 
> (easy_install macholib==dev)?

Yup, that problem is solved. Now it complains that I don't have wxPython 
libs, so I guess I need to make sure to import it explicitly, rather 
than letting matplotlib do it for me, so py2app will find it.

I got this error at some point:

/usr/bin/strip: the __LINKEDIT segment does not cover the end of the 
file (can't be processed) in: 
/Users/cbarker/HAZMAT/SmallToolsSVN/phCalculator/trunk/dist/test.app/Contents/Frameworks/libncurses.5.dylib
 
(for architecture i386)

But it seems to work -- is that a problem? And I don't know why I need 
ncurses anyway!

So, in summary:

with the latest py2app and removing the pytz line from the recipe, I 
have py2app working with MPL. Note that I'm not doing anything with 
time, so I don't know if there is a pytz problem or not.

-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

[EMAIL PROTECTED]

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] saving a PNg jsut as dispalyed

2008-03-27 Thread Ryan Krauss
I guess you could read the rcParams value that corresponds to the
screen display and set rcParams['savefig.dpi'] to that value (this
might work):

mydpi = rcParams['figure.dpi']
rcParams['savefig.dpi'] = mydpi

But that seems slightly hackish and maybe not much more elegant than
what you are currently doing with passing dpi into savefig.

FWIW,

Ryan

On Thu, Mar 27, 2008 at 1:57 PM, Christopher Barker
<[EMAIL PROTECTED]> wrote:
> Ryan Krauss wrote:
>  > I think this line in the rc file is the trick
>  >
>  > #savefig.dpi   : 100
>
>  nope. I think all that does is set the default dpi for savefig. I don't
>  want any default, I want it to use the same dpi that is being used for
>  display, and I don't know ahead of time what that is, I expect it is
>  system dependent.
>
>  Or do you mean that if I comment out that line, it will default to the
>  one already in use? In which case, I need to go figure out how to change
>  that in code, rather than messing with my matplotlibrc.
>
>
>
>  -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
>
>  [EMAIL PROTECTED]
>
>  -
>  Check out the new SourceForge.net Marketplace.
>  It's the best place to buy or sell services for
>  just about anything Open Source.
>  http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
>  ___
>  Matplotlib-users mailing list
>  Matplotlib-users@lists.sourceforge.net
>  https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Setting font family in ticks not possible. Bug?

2008-03-27 Thread Darren Dale
On Thursday 27 March 2008 01:27:28 pm Gerolf Ziegenhain wrote:
> More complete:
>
> I tried all permunations of backends. Now I stick to PS, because I use
> matplotlib from commandline with scripts. The environment is debian/etch
> with a current version of matplotlib (self compiled).
>
> Try this script
> 
> from pylab import *
>
> t = arange(0.0, 2.0, 0.01)
> s = sin(2*pi*t)
> plot(t, s)
> grid(True)
>
> # matlab handle graphics style
> xticklines = getp(gca(), 'xticklines')
> yticklines = getp(gca(), 'yticklines')
> xgridlines = getp(gca(), 'xgridlines')
> ygridlines = getp(gca(), 'ygridlines')
> xticklabels = getp(gca(), 'xticklabels')
> yticklabels = getp(gca(), 'yticklabels')
>
> setp(xticklines, 'linewidth', 3)
> setp(yticklines, 'linewidth', 3)
> setp(xgridlines, 'linestyle', '-')
> setp(ygridlines, 'linestyle', '-')
> setp(yticklabels, 'color', 'r', fontsize='medium')
> setp(xticklabels, 'color', 'r', fontsize='medium', family='sans-serif')
>
> savefig('axprops_demo')
> **
>
> On my system the line
>  setp(xticklabels, 'color', 'r', fontsize='medium', family='sans-serif')
> doesn't change the font family.

Do you use "usetex"? If you do, the mathtext is rendered using latex, and 
latex renders mathtext in serif fonts.

Darren

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] saving a PNg jsut as dispalyed

2008-03-27 Thread Christopher Barker
Ryan Krauss wrote:
> I think this line in the rc file is the trick
> 
> #savefig.dpi   : 100

nope. I think all that does is set the default dpi for savefig. I don't 
want any default, I want it to use the same dpi that is being used for 
display, and I don't know ahead of time what that is, I expect it is 
system dependent.

Or do you mean that if I comment out that line, it will default to the 
one already in use? In which case, I need to go figure out how to change 
that in code, rather than messing with my matplotlibrc.

-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

[EMAIL PROTECTED]

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] unicode filenames and MPL.

2008-03-27 Thread Michael Droettboom
Christopher Barker wrote:
> Michael Droettboom wrote:
>   
>> I think the real reason this wasn't done is that its tricky to do at the 
>> C level in a cross-platform way.  At present it uses the regular POSIX 
>> fopen in C, which isn't really "Unicode aware".
>> 
>
> The actual error is from trying to put the filename in a std::string, 
>   
Presumably because it doesn't decode into ASCII.
> but yes, I'm sure the fopen issue is the driver. Does C++ offer anything 
> better?
>   
Not in the C++ standard library in a cross platform way, that I'm aware 
of.  All three platforms (if you include Gtk, Qt etc.) have special 
Unicode-aware APIs, and each deals with things differently.  The 
approach I took basically leverages all the trouble the Python core guys 
put into to make this work cross-platform.
>See the "Unicode
>   
>> filenames" section of the link below for some of the complications.  
>> Linux is particularly hard to get right:
>>
>> http://www.amk.ca/python/howto/unicode
>> 
>
> Thanks, that's a good one.
>
>  >  you can do the following as a workaround
>   
>> (with a performance hit from making many Python function calls):
>>
>>   savefig(open(u"CrazyUnicodeFilename.png", "w"))
>> 
>
> thanks, I'll give that a try. I'm confused, though, why the many Python 
> function calls? the C++ code doesn't just grab the file pointer?
>   
No -- a while back, it was segfaulting when trying to do that (but I've 
since figured out why -- it was a reference counting problem).  In 
0.91.2, it calls the "write" method on the Python object for each block 
of PNG data.  SVN still supports that approach (to handle arbitrary 
Python file-like objects), but will extract the real C file handle if it 
is in fact a real file.

Mike

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] problem compiling matplotlib latex (mathtext) using py2exe

2008-03-27 Thread Bob Cumming
Hi all,
 
I have a application using a wxPython gui which has matplotlib figure, axes 
etc  The code works fine and the display of mathtext works fine when run in 
python.
 
When I compile it and try to display any text it doesn't render the text at all 
(this can be anything from a simple letter to a more complex equation).
 
I get an output error:
 
myDir\dist\library.zip\matplotlib\mathtext.py:722: MathTextWarning: 
Unrecognized symbol 'y'. Substituting with a dummy symbol.
 
I added the the include  "matplotlib.mathtext"  as before I got an error that 
it didn't know what mathtext was.
 
Any ideas?  I've looked on line at http://www.py2exe.org/index.cgi/MatPlotLib, 
and tried all they suggest but no luck so far.
 
Thanks for any ideas.
 
Cheers
 
 
my py2exe compile.py file is:
 
from distutils.core import setupimport py2exefrom distutils.core import setup# 
We need to import the glob module to search for all files.import globimport 
matplotlib
opts = {'py2exe': { "includes" : ["matplotlib.backends.backend_wxagg",  
 "matplotlib.figure","pylab", "numpy", 
"matplotlib.numerix.fft",   
"matplotlib.numerix.linear_algebra", "matplotlib.numerix.random_array", 
   "matplotlib.mathtext" ],'dll_excludes': 
['libgdk-win32-2.0-0.dll', 
'libgobject-2.0-0.dll']  }   }
# Looked online and tried this next line - but it doesn't compile.
#data_files=[matplotlib.get_py2exe_datafiles()]# Save matplotlib-data to 
mpl-data ( It is located in the matplotlib\mpl-data # folder and the compiled 
programs will look for it in \mpl-data# note: using 
matplotlib.get_mpldata_infodata_files = [(r'mpl-data', 
glob.glob(r'C:\Python25\Lib\site-packages\matplotlib\mpl-data\*.*')),   
 # Because matplotlibrc does not have an extension, glob does not find 
it (at least I think that's why)# So add it manually here:  
(r'mpl-data', 
[r'C:\Python25\Lib\site-packages\matplotlib\mpl-data\matplotlibrc']),   
   
(r'mpl-data\images',glob.glob(r'C:\Python25\Lib\site-packages\matplotlib\mpl-data\images\*.*')),
  
(r'mpl-data\fonts',glob.glob(r'C:\Python25\Lib\site-packages\matplotlib\mpl-data\fonts\*.*'))]
 
setup(windows=[{"script" : "main.py"}], options=opts,   data_files=data_files)
 
_
Win 100’s of Virgin Experience days with BigSnapSearch.com
http://www.bigsnapsearch.com-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] unicode filenames and MPL.

2008-03-27 Thread Christopher Barker
Michael Droettboom wrote:
> I think the real reason this wasn't done is that its tricky to do at the 
> C level in a cross-platform way.  At present it uses the regular POSIX 
> fopen in C, which isn't really "Unicode aware".

The actual error is from trying to put the filename in a std::string, 
but yes, I'm sure the fopen issue is the driver. Does C++ offer anything 
better?

   See the "Unicode
> filenames" section of the link below for some of the complications.  
> Linux is particularly hard to get right:
> 
> http://www.amk.ca/python/howto/unicode

Thanks, that's a good one.

 >  you can do the following as a workaround
> (with a performance hit from making many Python function calls):
> 
>   savefig(open(u"CrazyUnicodeFilename.png", "w"))

thanks, I'll give that a try. I'm confused, though, why the many Python 
function calls? the C++ code doesn't just grab the file pointer?

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

[EMAIL PROTECTED]

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Fwd: load data from string or array to Image

2008-03-27 Thread Christopher Barker
It's a very good idea, when posting questions to a list like this, to 
ask not only the specific question, but also give the background, so we 
can wee what problem you are trying to solve.

sa6113 wrote:
> I use matplotlib and Backend Agg to draw a plot , I want to show this plot in
> my GUI in specific area (Plot area) ,

This is background we need. However, you've left out a key point: what 
GUI toolkit are you using? There is no such thing as a python "image", 
but each toolkit has it's own implementation, so each needs to be 
treated differently.



  I need to have the image object in
> oder to show it, so I have to convert this plot to string or array or save
> in buffer and then load it to an Image ,

If you are using any of the supported back ends: Tk, QT, wx, GTK, then 
MPL has already solved that problem for you -- see the "embedded_in**" 
examples.

If you are using something else, then take a look at the various 
back-end codes -- one of them is probably similar enough to yous to give 
you inspiration.

And yes, you can get a string or buffer object of RBG data from 
FigureCanvasAgg.

> I want to know , can I accomplish
> this without using PIL ,

You shouldn't need PIL.

-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

[EMAIL PROTECTED]

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Setting font family in ticks not possible. Bug?

2008-03-27 Thread Gerolf Ziegenhain
More complete:

I tried all permunations of backends. Now I stick to PS, because I use
matplotlib from commandline with scripts. The environment is debian/etch
with a current version of matplotlib (self compiled).

Try this script

from pylab import *

t = arange(0.0, 2.0, 0.01)
s = sin(2*pi*t)
plot(t, s)
grid(True)

# matlab handle graphics style
xticklines = getp(gca(), 'xticklines')
yticklines = getp(gca(), 'yticklines')
xgridlines = getp(gca(), 'xgridlines')
ygridlines = getp(gca(), 'ygridlines')
xticklabels = getp(gca(), 'xticklabels')
yticklabels = getp(gca(), 'yticklabels')

setp(xticklines, 'linewidth', 3)
setp(yticklines, 'linewidth', 3)
setp(xgridlines, 'linestyle', '-')
setp(ygridlines, 'linestyle', '-')
setp(yticklabels, 'color', 'r', fontsize='medium')
setp(xticklabels, 'color', 'r', fontsize='medium', family='sans-serif')

savefig('axprops_demo')
**

On my system the line
 setp(xticklabels, 'color', 'r', fontsize='medium', family='sans-serif')
doesn't change the font family.

Best regards:
 Gerolf
-- 
Dipl. Phys. Gerolf Ziegenhain ([EMAIL PROTECTED])
Private: Klopstockstrasse 21 - 65187 Wiesbaden - Germany
Office: Room 46-332 - Erwin-Schrödinger-Str.46 - TU Kaiserslautern - Germany
Web: gerolf.ziegenhain.com
Tel.: +49-611-18840590
Fax: +49-611-18840599
-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [newbie] "live" plots of multiple lines

2008-03-27 Thread Chris Withers
Matthias Michler wrote:
> I'm not sure that I understand you correctly. The code I refering is the one 
> which I attached some mails ago. The following works for me:

Ah, okay, to get the problem I was having, change your script as follows:

> -
> from pylab import *
 > from datetime import datetime
> from time import sleep
> 
> ion() # interactive mode 'on'
> figure()
> ax = subplot(111, autoscale_on=True)
> 
> x, y = [datetime.now()], [0]
> line = plot(x, y, label="my_data")[0]  
> # get the line-object as the first 
> element 
> # of the tuple returned by plot
> legend()
> for i in arange(30):
> x.append(datetime.now())   # append new values
> y.append(i**2)
> line.set_data(x,y)# reset data
> ax.relim()# reset axes limits
> ax.autoscale_view()   # rescale axes
> draw()# redraw current figure
> sleep(0.3)# wait 0.3 seconds
> 
> ioff()
> show()

So, basically make the x axis time instead of numbers.
I think the problem is actually that the daets are quite long in their 
format. If they were rotated through 90 degress it'd likely be fine.
How would I do this?

Also, how would I get this kind of updating with bar charts or errorbars?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] does matplotlib have an analog to imagesc(x, y, X) of Matlab?

2008-03-27 Thread Vsevolod Kovalenko

Dear matplotlib

I have a newbie question (I am new to python, migrating from Matlab). Just
like the subject suggests, I need to display an image X stored in a matrix
(well, a 2D numpy array in fact) versus the coordinates specified by arrays
x and y. Further, it would be nice if mouse position was returned in terms
of those coordinates as well, but that's just for a nicety - I can map it
myself. But main thing is I failed to find the way to get the image
versuscoordinates in imshow() and figimage(). I also failed to find the
answer in this forum.

Hence I ask for any suggestions.
-- 
View this message in context: 
http://www.nabble.com/does-matplotlib-have-an-analog-to-imagesc%28x%2Cy%2CX%29-of-Matlab--tp16323613p16323613.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [wxpython-users] Controlling the wxpython matplotlib-frame

2008-03-27 Thread Laurent Dufrechou
Have you tryied : ipython -pylab ?
It launch an ipython shell that support mathplotlib gui loop.

-Message d'origine-
De : [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
] De la part de Wolfgang Kerzendorf
Envoyé : mercredi 26 mars 2008 08:31
À : matplotlib-users@lists.sourceforge.net;
[EMAIL PROTECTED]
Objet : [wxpython-users] Controlling the wxpython matplotlib-frame

Hello all,
I have trouble with one of my scripts that uses matplotlib when using  
python or ipython. The first time it opens, it does not hand the  
control back o the shell and can be used to work on the matplotlib  
figure interactively (I use an event handler and picker objects to  
change my plots) so it works really well. After I close the window the  
control is given back to the shell. This is how I want it to work,  
however at the second time the matplotlib plot opens the shell does  
not stop anymore, the script continues. When I used GTKAgg on my old  
linux box I had the same issue and bound a key to  
pylab.get_current_figure_manager().destroy(), which looked like a hack  
to me but  worked. This does not work anymore with wxPython, because  
the next time I open a plot I get an exception:

PyDeadObjectError: The C++ part of the FigureFrameWxAgg object has  
been deleted, attribute access no longer allowed.

I also think destroying the figure_manager is not the right way to do  
that. Whats a goog solution for this?
Thanks in advance
 Wolfgang

P.S.: I know I posted a similar thing yesterday, but I thought  
rephrasing the question might help with finding the solution
___
wxpython-users mailing list
[EMAIL PROTECTED]
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Setting font family in ticks not possible. Bug?

2008-03-27 Thread Michael Droettboom
Gerolf Ziegenhain wrote:
> Dear Mailinglist,
>
> Today I tried to change the fontset to sans-serif for a whole plot.
> Everything except the ticks could be adjusted. 
>
>
> This is what I tried first:
> ***
> ffont = {'size':'20','family':'sans-serif'}
> xticks(**ffont)
> ***
>   
Hmmm...  This works for me.  What backend are you using?  Perhaps it 
isn't updating?  Also, do these two lines + show() alone not work, or is 
it only in the context of something else?

Also, what platform are you on?

Mike

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [newbie] "live" plots of multiple lines

2008-03-27 Thread Matthias Michler
Hello Chris,

On Thursday 27 March 2008 12:22, Chris Withers wrote:
> Matthias Michler wrote:
> >>> the above script leads
> >>> to a different behaviour on my system.
> >>
> >> What is that behaviour and what version of matplotlib are you using?
> >
> > I think it is the expected behaviour. The number of xtick is aproximately
> > constant and some tick get sorted out, when the xlimits are increasing.
> > I'm using matplotlib-svn r5024 on Debian etch.
>
> Hmm, do you have a code snippet to demonstrate this?
> Maybe I'm missing some vital step that causes the axis to re-calculate
> its ticks?

I'm not sure that I understand you correctly. The code I refering is the one 
which I attached some mails ago. The following works for me:
-
from pylab import *
from time import sleep

ion() # interactive mode 'on'
figure()
ax = subplot(111, autoscale_on=True)

x, y = [0], [0]
line = plot(x, y, label="my_data")[0]  
# get the line-object as the first element 
# of the tuple returned by plot
legend()
for i in arange(30):
x.append(i)   # append new values
y.append(i**2)
line.set_data(x,y)# reset data
ax.relim()# reset axes limits
ax.autoscale_view()   # rescale axes
draw()# redraw current figure
sleep(0.3)# wait 0.3 seconds

ioff()
show()
--

And your mpltest.py works as well for me. 

best regards
Matthias

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Setting font family in ticks not possible. Bug?

2008-03-27 Thread Gerolf Ziegenhain
Dear Mailinglist,

Today I tried to change the fontset to sans-serif for a whole plot.
Everything except the ticks could be adjusted. 


This is what I tried first:
***
ffont = {'size':'20','family':'sans-serif'}
xticks(**ffont)
***
No change in the font family. But I can change the size without
problems. I removed the ~/.matplotlib/FONTCACHE stuff as described
here(2).


Following (1) I tried again to change the font using
***
import pylab
pylab.figure()
ax = pylab.axes()
ax.plot(pylab.arange(10))
xlabels = ax.get_xticklabels()
xlabel0 = xlabels[0]  # one of the xtick
labels
xlabel0.get_fontsize()
xlabel0.set_fontsize(20)
pylab.show() 
***
Again nothing changed.


Using ipython I got this:
***
In [192]: xlabels[0].get_fontname()
Out[192]: 'Bitstream Vera Serif, New Century Schoolbook, serif'

In [195]: xlabels[0].set_family("sans-serif")

In [196]: xlabels[0].get_fontname()
Out[196]: 'Bitstream Vera Sans, Lucida Grande, Verdana, sans-serif'

In [197]: show()
***


Summary:
It appears to me like I can change the default fontfamily, but somehow
there is no change in the output. 


What could be the problem?


Best regards:
   Gerolf

(1) http://www.nabble.com/axes-numbers-font-size-td14459877.html
(2) http://matplotlib.sourceforge.net/faq.html#FONTMISSING



-- 
Dipl. Phys. Gerolf Ziegenhain 
Web: http://gerolf.ziegenhain.com
Email:   [EMAIL PROTECTED]
Fax: +49 611 18840599
Phone:   +49 611 18840590
Office:  Erwin-Schrödinger-Str. 46 / Room 46.332 / 67663 Kaiserslautern / 
Germany
Private: Klopstockstr. 21 / 65187 Wiesbaden / Germany

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [newbie] "live" plots of multiple lines

2008-03-27 Thread Chris Withers
Matthias Michler wrote:
>>> the above script leads
>>> to a different behaviour on my system.
>> What is that behaviour and what version of matplotlib are you using?
> 
> I think it is the expected behaviour. The number of xtick is aproximately 
> constant and some tick get sorted out, when the xlimits are increasing.
> I'm using matplotlib-svn r5024 on Debian etch.

Hmm, do you have a code snippet to demonstrate this?
Maybe I'm missing some vital step that causes the axis to re-calculate 
its ticks?

> sorry. I have no idea where this problems comes from. I have seen that using 
> idle and the latest release of matplotlib on and winxp, but I can't reproduce 
> it on my linux system.

*sigh* ;-)

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basemaps - shapefile import/display for points

2008-03-27 Thread KURT PETERS
And, before someone asks, "Why are you using "h" and this line:
h= [seg[0]*0.000278,seg[1]*0.000278]
ax.annotate(seqnum[nshape],h)",
I was using this, instead, but tried to experiment with things to try to 
make things work right:
ax.annotate(seqnum[nshape],seg)
.
I usually don't "give up" and post a question unless I've tried a myriad of 
things, and unfortunately those things sometimes show up in the example 
code.

Regards,
Kurt



-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Basemaps - shapefile import/display for points

2008-03-27 Thread KURT PETERS
OK Jeff, Thanks for your help on the previous question - I had been playing 
with different projections and resolutions, so that's why the comments 
didn't match the actual settings in the procedure calls.  Now for a "real" 
problem:

I'm trying to plot the cities from this web site: 
http://nationalatlas.gov/metadata/citiesx020.faq.html
using that shapefile, which uses points, not polygons (it took a long time 
to figure out that difference from the example of fillstates.py).
http://nationalatlas.gov/atlasftp.html?openChapters=chpref#chpref

While I think I'm loading everything and displaying everything correctly, 
the values are not plotting right, nor do they seem realistic.

For instance the point values look like this (which really can't be right):

Shape num Fairbanks, coords=(42082.855349492747, 5336578.2660309337)
Shape num Anchorage, coords=(-442294.67146861833, 5031412.4918638617)

print shp_info - the second value shows to use points not polys:
(35432, 1, [-174.20294189453125, 17.711706161499023, 0.0, 0.0], 
[178.87460327148437, 71.290138244628906, 0.0, 0.0])
Dictionaries:
['STATE_FIPS', 'NAME', 'POP_2000', 'FEATURE', 'COUNTY', 'STATE', 'FIPS', 
'CITIESX020', 'FIPS55', 'DISPLAY', 'POP_RANGE']
STATE_FIPS = 02, NAME = Anchorage, POP_2000=260283, FEATURE = County Seat, 
COUNTY=Anchorage Borough, STATE=AK, FIPS=02020, CITIESX020 = 194, 
FIPS55=03000, DISPLAY=0, POP_RANGE=250,000 - 499,999



Here's the code:
===
import pylab as p
import numpy
from matplotlib.toolkits.basemap import Basemap as Basemap
from matplotlib.colors import rgb2hex
from matplotlib.patches import Polygon

# Lambert Conformal map of lower 48 states.
# create new figure
fig=p.figure()
m1 = Basemap(llcrnrlon=-119,llcrnrlat=22,urcrnrlon=-64,urcrnrlat=49,\
projection='lcc',lat_1=33,lat_2=45,lon_0=-95,resolution='c')
shp_info = 
m1.readshapefile(r'C:\Python25\Lib\basemap-0.9.9.1\examples\citiesx020','states',drawbounds=True)

ax=p.gca()

#define SHPT_POINT1Points
#define SHPT_ARC  3Arcs (Polylines, possible in parts)
#define SHPT_POLYGON  5Polygons (possible in parts)
#define SHPT_MULTIPOINT   8MultiPoint (related points)
print shp_info
print m1.states_info[0].keys()
seqnum={}
criteriatodisplay=[]
ii=0
for shapedict in m1.states_info:
if int(shapedict['POP_2000'])>10:
#'STATE_FIPS', 'NAME', 'POP_2000', 'FEATURE', 'COUNTY', 'STATE', 'FIPS', 
'CITIESX020', 'FIPS55', 'DISPLAY', 'POP_RANGE']
print 'STATE_FIPS = %s, NAME = %s, POP_2000=%s, FEATURE = %s, 
COUNTY=%s, STATE=%s, FIPS=%s, CITIESX020 = %s, FIPS55=%s, DISPLAY=%s, 
POP_RANGE=%s' %\
(str(shapedict['STATE_FIPS']), str(shapedict['NAME']), 
str(shapedict['POP_2000']),  str(shapedict['FEATURE']), 
str(shapedict['COUNTY']), str(shapedict['STATE']), str(shapedict['FIPS']), 
str(shapedict['CITIESX020']), str(shapedict['FIPS55']), 
str(shapedict['DISPLAY']), str(shapedict['POP_RANGE']))
seqnum[shapedict['CITIESX020']]=shapedict['NAME']
criteriatodisplay.append(shapedict['CITIESX020'])
ii+=1

print ii

for nshape,seg in enumerate(m1.states):
if nshape in criteriatodisplay:
print 'Shape num %s, coords=%s' % (seqnum[nshape], seg)
h= [seg[0]*0.000278,seg[1]*0.000278]

ax.annotate(seqnum[nshape],h)
m1.drawcoastlines()
m1.fillcontinents()
m1.drawcountries()
m1.drawstates()
m1.drawparallels(numpy.arange(25,65,4),labels=[1,0,0,0])
m1.drawmeridians(numpy.arange(-120,-40,4),labels=[0,0,0,1])
p.title('Test Cities')
p.show()
=
Regards,
Kurt



-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Not scaling properly? Am I doing something wrong?

2008-03-27 Thread Jeff Whitaker
KURT PETERS wrote:
> I'm trying what I thought was a simple test and getting "bad" results.  I am 
> taking some lat long coords, and feeding it into a map.  The conversion is 
> not giving "real" values that can be plotted on a map (and actually produces 
> an error when I use annotate).
> I'm including the simple code and the output:
>   
>> CODE<<<
>> 
> import pylab as p
> import numpy
> from matplotlib.toolkits.basemap import Basemap as Basemap
> from matplotlib.colors import rgb2hex
> from matplotlib.patches import Polygon
>
> # Lambert Conformal map of lower 48 states.
> # create new figure
> fig=p.figure()
> m1 = Basemap(llcrnrlon=-119,llcrnrlat=22,urcrnrlon=-64,urcrnrlat=49,\
> 
> projection='ortho',lat_1=33,lat_2=45,lon_0=-95,lat_0=40,resolution='c')
>
>
> #COS
> #D + M/60 + S/3600
> COSLat=38+56.0/60.0+0.013
> COSLon=-1*(104+48.0/60.0)
> WASHLat=38+53.0/60.0+23.0/3600.0
> WASHLon=-1*(77+32.0/3600.0)
>
> print COSLat
> x, y = m1(COSLat,COSLon)
> print 'x =%f, y=%f' % (x,y)
>
> m1.plot([x],[y],'ko')
> ax=p.gca()
> ax.annotate('COS1',(COSLat,COSLon))
> #ax.annotate('COS2',(x,y))
> ax.annotate('Wash1',(WASHLat,WASHLon))
> x, y = m1(WASHLat,WASHLon)
> #ax.annotate('Wash2',(x,y))
>
> m1.drawcoastlines()
> m1.fillcontinents()
> m1.drawcountries()
> m1.drawstates()
> m1.drawparallels(numpy.arange(25,65,4),labels=[1,0,0,0])
> m1.drawmeridians(numpy.arange(-120,-40,4),labels=[0,0,0,1])
> p.title('full resolution')
> p.show()
> >>
> 38.946333
> x =100.00, 
> y=100.00
>
> Regards,
> Kurt
>
>   

Kurt:  If you want the Lambert conformal projection, you should use 
projection='lcc', not 'ortho'. 

Nevertheless, your example works for me if I change the order of the 
arguments passed to the Basemap instance to

x, y = m1(COSLon,COSLat)

x, y = m1(WASHLon,WASHLat)

Note, longitude goes first.

Also, if you want 'full resolution' coastlines, use resolution='h'.

-Jeff



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


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] unicode filenames and MPL.

2008-03-27 Thread Michael Droettboom
I think the real reason this wasn't done is that its tricky to do at the 
C level in a cross-platform way.  At present it uses the regular POSIX 
fopen in C, which isn't really "Unicode aware".  See the "Unicode 
filenames" section of the link below for some of the complications.  
Linux is particularly hard to get right:

http://www.amk.ca/python/howto/unicode

However, the Python runtime does take care of many of these details in a 
(mostly) reasonable way.  I think the easiest solution is to open the 
file on the Python side (rather than using POSIX fopen in C as we do 
now), and pass the file descriptor itself over to C.  There was a bug in 
extracting the file descriptor from a Python file object in earlier 
versions of mpl, so it was removed a while ago, but I think I have it 
working again.

This should now be fixed on r5025 (branch) and r5026 (trunk)

Note that if you are running 0.91.2 (and not SVN, where this was 
subsequently broken in r4874), you can do the following as a workaround 
(with a performance hit from making many Python function calls):

   savefig(open(u"CrazyUnicodeFilename.png", "w"))

On a related note -- there is still an issue where fonts with Unicode 
paths can not be loaded.  That can hopefully be addressed in a similar 
manner, but there are a few more code paths to fix up there.

Mike


Christopher Barker wrote:
> Hi all,
>
> I'm writing a little MPL embedded in wxPython app, and just ran into this:
>
> Traceback (most recent call last):
> ...
> ...
> "/matplotlib-0.91.2-py2.5-macosx-10.3-fat.egg/matplotlib/backends/backend_agg.py",
>  
>
> line 397, in print_png
>  self.get_renderer()._renderer.write_png(filename, 
> self.figure.dpi.get())
> TypeError: cannot return std::string from Unicode object
>
> As soon as I saw it, I knew what happened: I'm running the unicode 
> version of wxPython, so the filename I got back from a SaveFile Dialog 
> is in unicode. Now, it's easy enough for me to turn that into a string 
> for now, but as more and more file systems are implemented in unicode, 
> it might be nice if we could use unicode file names with MPL.
>
> Are there any plans along these lines? Or are we just going to have to 
> wait for py3k?
>
> -CHB
>
>   

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Not scaling properly? Am I doing something wrong?

2008-03-27 Thread KURT PETERS
Forget it.  I was putting lat/long instead of long/lat.
Regards,
Kurt



-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Not scaling properly? Am I doing something wrong?

2008-03-27 Thread KURT PETERS
I'm trying what I thought was a simple test and getting "bad" results.  I am 
taking some lat long coords, and feeding it into a map.  The conversion is 
not giving "real" values that can be plotted on a map (and actually produces 
an error when I use annotate).
I'm including the simple code and the output:
>CODE<<<
import pylab as p
import numpy
from matplotlib.toolkits.basemap import Basemap as Basemap
from matplotlib.colors import rgb2hex
from matplotlib.patches import Polygon

# Lambert Conformal map of lower 48 states.
# create new figure
fig=p.figure()
m1 = Basemap(llcrnrlon=-119,llcrnrlat=22,urcrnrlon=-64,urcrnrlat=49,\

projection='ortho',lat_1=33,lat_2=45,lon_0=-95,lat_0=40,resolution='c')


#COS
#D + M/60 + S/3600
COSLat=38+56.0/60.0+0.013
COSLon=-1*(104+48.0/60.0)
WASHLat=38+53.0/60.0+23.0/3600.0
WASHLon=-1*(77+32.0/3600.0)

print COSLat
x, y = m1(COSLat,COSLon)
print 'x =%f, y=%f' % (x,y)

m1.plot([x],[y],'ko')
ax=p.gca()
ax.annotate('COS1',(COSLat,COSLon))
#ax.annotate('COS2',(x,y))
ax.annotate('Wash1',(WASHLat,WASHLon))
x, y = m1(WASHLat,WASHLon)
#ax.annotate('Wash2',(x,y))

m1.drawcoastlines()
m1.fillcontinents()
m1.drawcountries()
m1.drawstates()
m1.drawparallels(numpy.arange(25,65,4),labels=[1,0,0,0])
m1.drawmeridians(numpy.arange(-120,-40,4),labels=[0,0,0,1])
p.title('full resolution')
p.show()
>>
38.946333
x =100.00, 
y=100.00

Regards,
Kurt



-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Fwd: load data from string or array to Image

2008-03-27 Thread Anthony Floyd
On Wed, Mar 26, 2008 at 10:38 PM, sa6113 <[EMAIL PROTECTED]> wrote:
>
>  I use matplotlib and Backend Agg to draw a plot , I want to show this plot in
>  my GUI in specific area (Plot area) , I need to have the image object in

[snip]

>  Is it clear?

Not to me :)

Do you mean that you've already created a plot and just want to show
it in your GUI?

What GUI toolkit are you using?  You may want to look in the various
embedding_in_*.py examples.

A>

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [newbie] "live" plots of multiple lines

2008-03-27 Thread Matthias Michler
On Wednesday 26 March 2008 19:39, Chris Withers wrote:
> Matthias Michler wrote:
> >> My x-axis is time, and as new points are plotted, even though I'm
> >> following the above recipe pretty closely, the x-tick spacing isn't
> >> getting sorted out, so I end up with just a jumble as the tick labels
> >> for the x-axis. Do you know why this might be?
> >
> > I'm not sure I understand correctly, but if the number of xticks
> > increases dramatically (nobody could see the individual ticks),
>
> Indeed, it looks like the Tick spacing is staying as it was when the
> first point was plotted, so when hundreds more points are plotted, I
> just get a jumble of labels on the x-axis.
>
> > the above script leads
> > to a different behaviour on my system.
>
> What is that behaviour and what version of matplotlib are you using?

I think it is the expected behaviour. The number of xtick is aproximately 
constant and some tick get sorted out, when the xlimits are increasing.
I'm using matplotlib-svn r5024 on Debian etch.

> >> Shame I get that horrible exception when I do close the plot window,
> >> wish I knew how to make it stop :-S
> >
> > I don't know which exception you refer to, but sometimes if gives
> > problems if the interactive mode wasn't switched off ("ioff()") before
> > the scripts ends or "show()" is called.
>
> If I run the attached script, and hit Ctrl-C in the DOS box running it,
> I get:
>
> C:\>python mpltest.py
> Traceback (most recent call last):
>File "mpltest.py", line 3, in 
>  show()
>File
> "C:\Python25\Lib\site-packages\matplotlib\backends\backend_tkagg.py", li
> e 76, in show
>  Tk.mainloop()
>File "C:\Python25\lib\lib-tk\Tkinter.py", line 328, in mainloop
>  _default_root.tk.mainloop(n)
> KeyboardInterrupt
> Fatal Python error: PyEval_RestoreThread: NULL tstate
>
> This application has requested the Runtime to terminate it in an unusual
> way.
> Please contact the application's support team for more information.
>
> I've had a similar error when I hit the red cross in the corner of the
> window with other scripts, although not this one :-S

sorry. I have no idea where this problems comes from. I have seen that using 
idle and the latest release of matplotlib on and winxp, but I can't reproduce 
it on my linux system.

Matthias

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users