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
(9)
2
(6)
3
(8)
4
(6)
5
6
(1)
7
(4)
8
(15)
9
(11)
10
11
(1)
12
(13)
13
(5)
14
(10)
15
(12)
16
(7)
17
(12)
18
(5)
19
(4)
20
(11)
21
(4)
22
(11)
23
(28)
24
(24)
25
(23)
26
(6)
27
(7)
28
(17)
29
(21)
30
(6)



Showing results of 285

<< < 1 .. 10 11 12 (Page 12 of 12)
From: Jeff W. <js...@fa...> - 2008年04月02日 00:55:55
Carl Wenrich wrote:
> Thanks, Jeff. The hlines work fine. But the ylim doesn't change 
> anything. I still get a plot that goes from 20 to 90 instead of 0 to 
> 100. Here's my code. Please take a quick look and tell me where I have 
> to put the ylim statement.
>
> fig = figure(figsize=(6,2))
> title('Dow Jones Industrials (^DJI) Relative Strength Index (RSI)', 
> fontsize=8)
>
> months = MonthLocator(range(1,13,2), bymonthday=1)
> monthsFmt = DateFormatter("%b '%y")
>
> bx = fig.add_subplot(111)
> bx.grid(True)
> bx.plot_date(dates, rsis, '-')
>
> bx.xaxis.set_major_locator(months)
> bx.xaxis.set_major_formatter(monthsFmt)
>
> axhline(30,color='g')
> axhline(70,color='r')
>
> fig.savefig('dow_30_rsi')
>
Carl: I can't run this, since the 'dates' and 'rsis' objects are not 
defined, but I'd try putting the ylim last, after the axhlines.
-Jeff
>
> */Jeff Whitaker <js...@fa...>/* wrote:
>
> carlwenrich wrote:
> > I have a dataset where the values range from 20 to 90, but I
> want the y
> > coordinates to go from 0 to 100.
> >
> import pylab
>
> pylab.ylim(0,100)
> > Also, how can I draw a highlight (colored line) across the chart
> at 30, and
> > another at 70?
> >
>
> pylab.axhline(30,color='r')
> pylab.axhline(70.color='r')
>
> HTH,
>
> -Jeff
>
>
> -- 
> Jeffrey S. Whitaker Phone : (303)497-6313
> Meteorologist FAX : (303)497-6449
> NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
> 325 Broadway Office : Skaggs Research Cntr 1D-124
> Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
>
>
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
325 Broadway Boulder, CO, USA 80305-3328
From: Jeff W. <js...@fa...> - 2008年04月01日 23:06:16
carlwenrich wrote:
> I have a dataset where the values range from 20 to 90, but I want the y
> coordinates to go from 0 to 100.
> 
import pylab
pylab.ylim(0,100)
> Also, how can I draw a highlight (colored line) across the chart at 30, and
> another at 70?
> 
pylab.axhline(30,color='r')
pylab.axhline(70.color='r')
HTH,
-Jeff
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: carlwenrich <car...@ya...> - 2008年04月01日 22:17:49
I have a dataset where the values range from 20 to 90, but I want the y
coordinates to go from 0 to 100.
Also, how can I draw a highlight (colored line) across the chart at 30, and
another at 70?
-- 
View this message in context: http://www.nabble.com/How-do-I-make-the-ticks-go-from-0-to-100--tp16427710p16427710.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jeff W. <js...@fa...> - 2008年04月01日 21:54:55
KURT PETERS wrote:
> Jeff,
> Do you think it's possible the names or CITIESX020 variable are not 
> being brought in in the right order?
> I modified my code to use scatter, and, although it looks like the 
> dots are in the right place, the names aren't matching?
> see 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
> #http://nationalatlas.gov/metadata/citiesx020.faq.html
> #http://nationalatlas.gov/atlasftp.html?openChapters=chpref#chpref
> 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_POINT 1 Points
> #define SHPT_ARC 3 Arcs (Polylines, possible in parts)
> #define SHPT_POLYGON 5 Polygons (possible in parts)
> #define SHPT_MULTIPOINT 8 MultiPoint (related points)
> print shp_info
> print m1.states_info[0].keys()
> seqnum={}
> criteriatodisplay=[]
> names={}
> ii=0
> for shapedict in m1.states_info:
> if int(shapedict['POP_2000'])>100000:
> #'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']))
> # have an index of the names
> seqnum[shapedict['CITIESX020']]=shapedict['NAME']
> criteriatodisplay.append(shapedict['CITIESX020'])
>
> ii+=1
>
> print ii
> #x, y = zip(*m1.states)
> #print m1.states[1]
> #print x[1]
> #print y[1]
> #ii=0
> x=[]
> y=[]
> ii=0
> for nshape,seg in enumerate(m1.states):
> if nshape in criteriatodisplay:
> x.append(seg[0])
> y.append(seg[1])
> p.text(seg[0],seg[1],seqnum[nshape],fontsize=12)
> ii+=1
>
> #print 'Shape num %s, coords=%s' % (seqnum[nshape], seg)
> # ax.annotate(seqnum[nshape],seg)
> m1.scatter(x,y,2,'b',marker='o',faceted=False,zorder=10)
>
> #ax.annotate(s='s',xy=(int(x),int(y)))
> #p.figtext(x,y,'o',weight='heavy', size = 16)
> 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()
> ========
> kurt
>
> <snip>
>
>
Kurt: If I look at the least entry in m.states_info (Newport, VT), the 
corresponding x,y location in m.states corresponds to 44.93N, -72.21W, 
which looks about right to me. I guess I'm still not clear on what the 
issue is. Could you distill your example code down to something very 
simple that clearly demonstrates the problem?
-Jeff
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: KURT P. <pet...@ms...> - 2008年04月01日 21:31:37
Jeff,
 Do you think it's possible the names or CITIESX020 variable are not being 
brought in in the right order?
 I modified my code to use scatter, and, although it looks like the dots 
are in the right place, the names aren't matching?
see 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
#http://nationalatlas.gov/metadata/citiesx020.faq.html
#http://nationalatlas.gov/atlasftp.html?openChapters=chpref#chpref
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_POINT 1 Points
#define SHPT_ARC 3 Arcs (Polylines, possible in parts)
#define SHPT_POLYGON 5 Polygons (possible in parts)
#define SHPT_MULTIPOINT 8 MultiPoint (related points)
print shp_info
print m1.states_info[0].keys()
seqnum={}
criteriatodisplay=[]
names={}
ii=0
for shapedict in m1.states_info:
 if int(shapedict['POP_2000'])>100000:
#'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']))
 # have an index of the names
 seqnum[shapedict['CITIESX020']]=shapedict['NAME']
 criteriatodisplay.append(shapedict['CITIESX020'])
 ii+=1
print ii
#x, y = zip(*m1.states)
#print m1.states[1]
#print x[1]
#print y[1]
#ii=0
x=[]
y=[]
ii=0
for nshape,seg in enumerate(m1.states):
 if nshape in criteriatodisplay:
 x.append(seg[0])
 y.append(seg[1])
 p.text(seg[0],seg[1],seqnum[nshape],fontsize=12)
 ii+=1
 #print 'Shape num %s, coords=%s' % (seqnum[nshape], seg)
 # ax.annotate(seqnum[nshape],seg)
m1.scatter(x,y,2,'b',marker='o',faceted=False,zorder=10)
#ax.annotate(s='s',xy=(int(x),int(y)))
#p.figtext(x,y,'o',weight='heavy', size = 16)
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()
========
kurt
<snip>
From: Jeff W. <js...@fa...> - 2008年04月01日 21:22:45
KURT PETERS wrote:
> can someone explain why scatter would work but gca.annotate would not when 
> plotting data on a map (see previous posts)?
> I've also tried pylib.figtext and that doesn't work either.
>
> Regards,
> Kurt
>
>
> 
Kurt: This works for me (with the latest svn version of basemap and 
matplotlib). Does it not work for you?
import pylab as p
from mpl_toolkits.basemap import Basemap as Basemap # use for svn
#from matplotlib.toolkits.basemap import Basemap # use for released version
m = Basemap(llcrnrlon=-119,llcrnrlat=22,urcrnrlon=-64,urcrnrlat=49,\
 projection='lcc',lat_1=33,lat_2=45,lon_0=-95,resolution='c')
shp_info = m.readshapefile('citiesx020','cities')
for xy in m.cities:
 p.gca().annotate('x',xy)
m.drawcoastlines()
p.show()
-Jeff
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: KURT P. <pet...@ms...> - 2008年04月01日 21:06:55
can someone explain why scatter would work but gca.annotate would not when 
plotting data on a map (see previous posts)?
 I've also tried pylib.figtext and that doesn't work either.
Regards,
Kurt
From: Robert K. <rob...@gm...> - 2008年04月01日 18:20:56
John wrote:
> 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:
> 
> *[jfb@andLinux ~]$ 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 "<stdin>", line 1, in <module>
> File "/usr/lib/python2.5/site-packages/scipy/__init__.py", line 18, in 
> <module>
> import pkg_resources as _pr # activate namespace packages 
> (manipulates __path__)
> File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 2581, 
> in <module>
> 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 <lambda>
> 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'
You have a new.py module somewhere which is interfering with the standard 
library's "new" module. Find it and rename it.
-- 
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
 -- Umberto Eco
From: Michael D. <md...@st...> - 2008年04月01日 12:27:56
Nick Susch wrote:
> Hi,
>
> I am new to this list, so forgive me if this has been asked before. I 
> am trying to do a radial plot and the following code does not seem to 
> work:
>
> # ------< START CODE >-------
> import pylab
> import matplotlib
>
> fig = pylab.figure(figsize=(8,8))
> ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True)
>
> pylab.hold(True)
> ax.plot([4.189, 4.188],[41.347, 41.058], color = 'green', lw=1)
> #ax.plot([4.199, 4.188],[41.347, 41.058], color = 'green', lw=1)
> ax.set_rmax(80) # scale plot
> pylab.show()
> # ------< END CODE >-------
>
>
> When you run this, the entire background of the plot turns green. If 
> you comment out the first "ax.plot" and uncomment the line below it, 
> it works as expected. Any ideas as to what is going on? Is there some 
> kind of limitation to the smallest line allowed? Thanks for any help!
It may be that the line is too close to unity and Agg (the rendering 
engine) is messing up. That's the best explanation I can think of as 
well...
However, it does seem like other backends (Ps, Pdf, Cairo) do work. You 
may try using those as a workaround for now.
Note that the SVN trunk also works, possibly due to a) upgrading Agg 2.3 
to 2.4, and b) a pretty radical overhaul of the rendering engine, 
particularly polar plots.
Mike
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Michael D. <md...@st...> - 2008年04月01日 12:16:07
Christopher Barker wrote:
> Hi all,
>
> as far as I can tell, matplotlib.py2exe_datafiles is broken with the 
> latest release. Is it getting fixed?
>
> Also, there is a LOT of stuff in there -- is there a way to strip out 
> the stuff you may not need for a particular application? I'm using MPl 
> embedded in a wxPython app, and I don't need the icons, etc, nor do a 
> need a bunch of fonts. I suppose it's just disk space, though.
>
> One more question:
>
> In mpl-data, there are a bunch of images and fonts. There are also 
> subdirectories "images", and "fonts", with a bunch more? My the 
> different places for these?
> 
I can't speak for py2exe specifically, but the source tree doesn't have 
any fonts or images at the root of mpl-data. Perhaps the py2exe script 
is copying things there?
Mike
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
2 messages has been excluded from this view by a project administrator.

Showing results of 285

<< < 1 .. 10 11 12 (Page 12 of 12)
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 によって変換されたページ (->オリジナル) /