[Matplotlib-users] Fonts for eps files

2008-11-26 Thread John Mariska
Many scientific journals ask that authors submit figures as eps
files, preferably using one of the standard 35 ps fonts--usually
Helvetica or Times. I've been able to tweak the matplotlib.rc
file to make eps plot files that have all the numbers and labels
in Helvetica (or Times), but have a problem dealing with simple
superscipts and subscripts. Is there a way to get simple LaTeX
strings, such as r'ergs cm$^{-2}$ s$^{-1}$', to use only
Helvetica or Times?

John Mariska

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Fonts for eps files

2008-11-26 Thread Michael Droettboom
If you have "ps.useafm" set to True, (and "text.usetex" set to False), 
the mathtext renderer will stick to the standard 35 ps fonts, with the 
obvious limitations in the number of symbols available, and no radical 
signs, etc.  By default, all math is serif (in this case Times).  You 
can force sans-serif (Helvetica), by wrapping the math in \mathsf{}, eg.

  r'ergs cm$\mathsf{^{-2}}$ s$\mathsf{^{-1}}$'

Let me know if the above doesn't work for you.  I only tested with SVN head.

Cheers,
Mike

John Mariska wrote:
> Many scientific journals ask that authors submit figures as eps
> files, preferably using one of the standard 35 ps fonts--usually
> Helvetica or Times. I've been able to tweak the matplotlib.rc
> file to make eps plot files that have all the numbers and labels
> in Helvetica (or Times), but have a problem dealing with simple
> superscipts and subscripts. Is there a way to get simple LaTeX
> strings, such as r'ergs cm$^{-2}$ s$^{-1}$', to use only
> Helvetica or Times?
>
> John Mariska
>
> -
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>   

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


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Fonts for eps files

2008-11-26 Thread Michael Droettboom
I can confirm that this is broken in 0.98.3 and fixed in SVN.  It's not 
clear if a simple patch is possible -- the fix actually extends over a 
number of changesets.

If you're able to build from SVN, I'm rather certain that should resolve 
this issue.  Otherwise, you may have to wait for the next release.

Cheers,
Mike

John Mariska wrote:
> Hi Mike,
>
> Thanks for the prompt response to my post. I've tried your solution 
> and have not been successful. Am not running the svn head, but am at 
> 0.98.3. Here is the little test code I have:
>
> #!/usr/bin/env python
>
> import numpy as np
> import matplotlib as mpl
> mpl.use('PS')
> from matplotlib.pyplot import figure, show
>
> mpl.rc('font', size=20)
> mpl.rc('ps', useafm=True)
> mpl.rc('text', usetex=False)
>
> fig = figure()
> fig.subplots_adjust(bottom=0.15, left=0.15)
>
> x = np.arange(0.0, 10.2, 0.2)
>
> ax = fig.add_subplot(111)
> ax.plot(x, np.sin(x), 'bo')
>
> ax.set_xlabel(r'x (cm$\mathsf{^{-3}}$)')
> ax.set_ylabel(r'y (ergs cm$\mathsf{^{-2}}$ s$^{-1}$)')
>
> show()
> fig.savefig('test_latex.eps')
>
> If I do a grep findfont test_latex.eps, the result is:
>
> /Helvetica findfont
> /Helvetica findfont
> /Helvetica findfont
> /Helvetica findfont
> /Helvetica findfont
> /Helvetica findfont
> /BitstreamVeraSans-Roman findfont
> /Cmsy10 findfont
> /Cmr10 findfont
> /BitstreamVeraSans-Roman findfont
> /Helvetica findfont
> /Helvetica findfont
> /Helvetica findfont
> /Helvetica findfont
> /Helvetica findfont
> /BitstreamVeraSans-Roman findfont
> /Cmsy10 findfont
> /Cmr10 findfont
> /BitstreamVeraSans-Roman findfont
> /Cmsy10 findfont
> /Cmr10 findfont
> /BitstreamVeraSans-Roman findfont
>
> I've also messed with making the changes in the matplolibrc file, 
> without complete success. It may just be that this area of matplotlib 
> is still a moving target.
>
> John M.
>
> Michael Droettboom wrote:
>> If you have "ps.useafm" set to True, (and "text.usetex" set to 
>> False), the mathtext renderer will stick to the standard 35 ps fonts, 
>> with the obvious limitations in the number of symbols available, and 
>> no radical signs, etc.  By default, all math is serif (in this case 
>> Times).  You can force sans-serif (Helvetica), by wrapping the math 
>> in \mathsf{}, eg.
>>
>>  r'ergs cm$\mathsf{^{-2}}$ s$\mathsf{^{-1}}$'
>>
>> Let me know if the above doesn't work for you.  I only tested with 
>> SVN head.
>>
>> Cheers,
>> Mike
>>
>> John Mariska wrote:
>>> Many scientific journals ask that authors submit figures as eps
>>> files, preferably using one of the standard 35 ps fonts--usually
>>> Helvetica or Times. I've been able to tweak the matplotlib.rc
>>> file to make eps plot files that have all the numbers and labels
>>> in Helvetica (or Times), but have a problem dealing with simple
>>> superscipts and subscripts. Is there a way to get simple LaTeX
>>> strings, such as r'ergs cm$^{-2}$ s$^{-1}$', to use only
>>> Helvetica or Times?
>>>
>>> John Mariska
>>>
>>> - 
>>>
>>> This SF.Net email is sponsored by the Moblin Your Move Developer's 
>>> challenge
>>> Build the coolest Linux based applications with Moblin SDK & win 
>>> great prizes
>>> Grand prize is a trip for two to an Open Source event anywhere in 
>>> the world
>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>> ___
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>   
>>

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


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Unable to manipulate tick labels Basemap

2008-11-26 Thread Zane Selvans
I want to change the size of the lat/lon labels on a Basemap map, and  
from the documentation, it seems like this ought to be possible using  
drawparallels() and drawmeridians() with a keword argument, e.g.:


linmap.drawparallels(range(-90,90,30), labels=[1,0,0,1], fontsize='x- 
small')


but that doesn't have any effect.  I've also tried size='x-small' and  
size/fontsize=9 and none of them seem to do anything.  I also can't  
seem to obtain lists of ticklabels from the Axes instance that the map  
is inside of, to change their sizes.  On normal (non-Basemap) figures,  
I can do something like:


for ticklabel in ax.get_xticklabels():
ticklabel.set_size('x-small')

to re-size them after the fact, but on the Basemap axes,  
get_xticklabels() returns a zero length list.


Does anybody know where are these things hiding?

Thanks!
Zane

--
Zane Selvans
Amateur Earthling
[EMAIL PROTECTED]
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F








-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Plotting edges between nodes

2008-11-26 Thread Mauro Cavalcanti
Dear ALL,

I want to plot lines ("edges") between a sequence of points ("nodes"),
using the following code:

from pylab import *
import matplotlib.pyplot as plt
nodes = load('nodes.dat')
edges = load('edges.dat')
n = nodes.shape[0]
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
plt.plot(nodes[:,0],nodes[:,1],'ob')
for i in range(n):
try:
t = edges[i,0]-1
u = edges[i,1]-1
x = [nodes[t,0], nodes[u,0]]
y = [nodes[t,1], nodes[u,1]]
plot(x,y,'-b')
except:
continue
plt.show()

And here are the "nodes.dat"

-61.05 10.4
-79.43 9.15
-70.67 9.533
-63.116667 7.917
-63.116667 10.55
-81.18 7.517
-56.48 3.1
-60.5 3.933
-81.016667 7.667
-67.43 8.933
-65.97 10.316667
-78.93 8.383
-72.87 9.833
-68.4 10.616667
-72.98 10.616667

...and "edges.dat" files:

15
45
5   11
   10   11
   10   14
3   14
3   13
   13   15
48
78
   12   13
2   12
29
69

The above code works quite well. However, I do *not* want to have the
plot done for each edge inside the for loop; instead, I would like to
have the x,y points stored for being plotted at once, using a plot
command issued outside the loop. It seems that it could be done using
MPL line collections, but I could not figure out how to do this. Any
hints?

Thanks in advance for any assistance you can provide.

With best regards,

-- 
Dr. Mauro J. Cavalcanti
Ecoinformatics Studio
P.O. Box 46521, CEP 20551-970
Rio de Janeiro, RJ, BRASIL
E-mail: [EMAIL PROTECTED]
Web: http://studio.infobio.net
Linux Registered User #473524 * Ubuntu User #22717
"Life is complex. It consists of real and imaginary parts."

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Plotting w/ cyclic boundaries

2008-11-26 Thread Zane Selvans
Does anybody have a good method for implementing cyclic boundaries in  
matplotlib axes?


It's easy when plotting points to just mod() the values before sending  
them to the plot, but when drawing lines or patches, it would be nice  
if there were an underlying mechanism for intelligently splitting the  
patch or line when it runs off the edge (instead of either not seeing  
it, or calling mod() and getting the mess of lines dragged all the way  
across the plot to where they continue on the other side).  I'd use  
this primarily for global-scale maps in Basemap... but I could see it  
being more generally useful when dealing with a periodic space where  
what you're interested in is the phase.


Or maybe this already exists and I'm just not seeing it?

--
Zane Selvans
Amateur Earthling
[EMAIL PROTECTED]
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F








-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] A wxPython/Matplotlib/Basemap example

2008-11-26 Thread Tim Michelsen
Hello Mauro,

> I am not just "trying",
Sorry for "disregarding" your using the term trying.

  I am indeed implementing a software package
> for species distribution mapping and biogeographic analysis, using
> wxPython/Matplotlib.
Thanks for being more specific. There is another program aiming at 
/similar/ goals:
http://www.metamodellers.com/epigrass.html

But this is not my domain of work...

> And, by the way, it is going quite well.
My crongrats!

> Both Thuban and QGis, as generalized implementations of GIS, are far
> from adequate for my needs (and of fellow conservation biologists).
I just thought of there because they easyly convert CSV into 
geographical data.

In case you are after format conversion you may see: ogr2ogr.

> Hope this helps.
Vice versa. I thought that my ideas my be useful.

Nevertheless, have all possible sucess!

Kind regards,
Timmie


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Matplotlib or numpy bug?

2008-11-26 Thread Jesper Larsen
Hi matplotlib users,

The script below produces weird arrows when using numpy 1.2.1 and
matplotlib trunk. When I reinstall numpy 1.2.0 instead it seems fine.
I use the Agg backend. I am not sure where to start in tracking the
bug down so I will just post the rather sparse information that I
have.

Please let me know if you need any further information from me.

Best regards,
Jesper

import math
import numpy.ma as ma
import pylab as p

a = ma.ones((10,10))
a[:2,:] = ma.masked
a[:,9:] = ma.masked
b = ma.array(-a)
nx, ny = a.shape

for i in range(nx):
  for j in range(ny):
a[i,j] = a[i,j]*math.cos(i*j)
b[i,j] = -b[i,j]*math.sin(i*j)

print a

p.quiver(a,b)
p.grid(True)
p.savefig('test1.png')

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Matplotlib or numpy bug?

2008-11-26 Thread Eric Firing
Jesper Larsen wrote:
> Hi matplotlib users,
> 
> The script below produces weird arrows when using numpy 1.2.1 and
> matplotlib trunk. When I reinstall numpy 1.2.0 instead it seems fine.
> I use the Agg backend. I am not sure where to start in tracking the
> bug down so I will just post the rather sparse information that I
> have.

It looks OK to me with mpl and numpy from svn.

Eric

> 
> Please let me know if you need any further information from me.
> 
> Best regards,
> Jesper
> 
> import math
> import numpy.ma as ma
> import pylab as p
> 
> a = ma.ones((10,10))
> a[:2,:] = ma.masked
> a[:,9:] = ma.masked
> b = ma.array(-a)
> nx, ny = a.shape
> 
> for i in range(nx):
>   for j in range(ny):
> a[i,j] = a[i,j]*math.cos(i*j)
> b[i,j] = -b[i,j]*math.sin(i*j)
> 
> print a
> 
> p.quiver(a,b)
> p.grid(True)
> p.savefig('test1.png')
> 
> -
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users