SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S






1
(5)
2
3
(3)
4
(16)
5
(8)
6
(22)
7
(10)
8
(18)
9
(11)
10
(7)
11
(16)
12
(1)
13
(10)
14
(14)
15
(2)
16
(3)
17
(19)
18
(24)
19
(35)
20
(38)
21
(27)
22
(1)
23
(9)
24
(6)
25
(24)
26
(9)
27
(7)
28
(5)
29
(9)
30
(4)






Showing 9 results of 9

From: Jesper L. <jes...@gm...> - 2008年11月26日 23:13:20
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')
From: Tim M. <tim...@gm...> - 2008年11月26日 22:34:25
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
From: Zane S. <za...@id...> - 2008年11月26日 22:24:23
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
za...@id...
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F
From: Mauro C. <mau...@gm...> - 2008年11月26日 20:07:56
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.4333333333 9.15
-70.6666666667 9.53333333333
-63.1166666667 7.91666666667
-63.1166666667 10.55
-81.1833333333 7.51666666667
-56.4833333333 3.1
-60.5 3.93333333333
-81.0166666667 7.66666666667
-67.4333333333 8.93333333333
-65.9666666667 10.3166666667
-78.9333333333 8.38333333333
-72.8666666667 9.83333333333
-68.4 10.6166666667
-72.9833333333 10.6166666667
...and "edges.dat" files:
 1 5
 4 5
 5 11
 10 11
 10 14
 3 14
 3 13
 13 15
 4 8
 7 8
 12 13
 2 12
 2 9
 6 9
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: mau...@gm...
Web: http://studio.infobio.net
Linux Registered User #473524 * Ubuntu User #22717
"Life is complex. It consists of real and imaginary parts."
From: Zane S. <za...@id...> - 2008年11月26日 18:07:46
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
za...@id...
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F
From: Michael D. <md...@st...> - 2008年11月26日 18:05:35
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
>>> Mat...@li...
>>> 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
From: Michael D. <md...@st...> - 2008年11月26日 15:59:54
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
> Mat...@li...
> 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
From: John M. <ma...@nr...> - 2008年11月26日 15:51:56
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
From: Nils W. <nw...@ia...> - 2008年11月26日 07:11:17
Hi all,
I would like to visualize the ovality of a perturbed
circular path by a polar plot.
How can I improve the view wrt to scaling and ticks ?
from pylab import linspace, polar, xticks, yticks, show, 
savefig, subplot, figure
from numpy.random import rand
from numpy import ones, exp, pi, r_
theta = linspace(0.,2*pi,25)
r = 20.*ones(24)
r = r_[r,r[0]]
noise = 2.*rand(24)-ones(24)
noise = r_[noise,noise[0]]
figure(1)
polar(theta,(r+noise))
figure(2)
polar(theta,(r+noise)/r)
show()
Any pointer would be appreciated.
Nils

Showing 9 results of 9

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /