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





Showing results of 39

1 2 > >> (Page 1 of 2)
From: Tom D. <tdi...@ph...> - 2011年02月09日 23:52:24
I am using matplotlib pylab in association with ipython -pylab to show 
many large (~2000x2000 or larger) images. Each time I show another 
image it consumes more memory until eventually exhausting all system 
memory and making my whole system unresponsive.
The easiest way to replicate this behaviour is with
a = ones((3333,3333))
imshow(a)
optionally
close()
and then
imshow(a)
again. I am using ipython .10.1 and matplotlib 0.99.3. Is there 
something I should be doing differently to avoid this problem? Is it 
fixed in a later version?
Thanks,
Tom
From: Goyo <goy...@gm...> - 2011年02月09日 22:58:04
2011年2月9日 Curiouslearn <cur...@gm...>
>
> Can you please see the code below and let me know why the png figure
> comes out empty (it only contains the x-axis, does not contain the
> scatterplot). The pdf file has no such problems.
Seems like mpl is getting confused because of the rect argument of
add_axes. Note that bottom is 0.3 and height is 0.9 so bottom + heigt
> 1. Maybe different backends differs handling the overflow.
Does this change in line 12 fix your issue?:
ax1 = fig1.add_axes([0.1, 0.3, 0.8, 0.6])
Goyo
>
> I have tried saving another usual line plot in .png format and I had
> no problems. Does this have to do with scatter plot and .png format?
>
> Thank you.
>
> The code
>
> import matplotlib.pyplot as plt
> import numpy
>
> differences = numpy.random.uniform(-2,2,190)
>
> bin_values = numpy.arange(-2,2.6,0.1)
> hist, bins = numpy.histogram(differences, bins = bin_values)
>
> fig1 = plt.figure()
> fig1.set_figwidth(6)
> fig1.set_figheight(3)
> ax1 = fig1.add_axes([0.1, 0.3, 0.8, 0.9])
> ax1.patch.set_facecolor('Linen')
>
> for left, hist_val in zip(bins[:-1], hist):
>  xvec = [left]*hist_val
>  yvec = 0.05*numpy.arange(hist_val) + 0.1
>  if len(xvec) > 0:
>    ax1.scatter(xvec,yvec)
>
> ax1.axvline(1.3, ymax=0.6, color='DarkGreen')
>
> # The frame of the axes is referred to as
> # spines in matplotlib
> for i in ax1.spines.iteritems():
>  if i[0] in ['top','right', 'left']:
>    i[1].set_visible(False)
>  print i
>
>
> # Ticks only in bottom
> ax1.xaxis.set_ticks_position('bottom')
> ax1.yaxis.set_ticks_position('none')
> ax1.set_ylim(bottom=0,top=1.5)
>
>
>
> fig1.savefig('trial_figure.png', facecolor='Linen')
> fig1.savefig('trial_figure.pdf', facecolor='Linen')
>
> ------------------------------------------------------------------------------
> The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
> Pinpoint memory and threading errors before they happen.
> Find and fix more than 250 security defects in the development cycle.
> Locate bottlenecks in serial and parallel code that limit performance.
> http://p.sf.net/sfu/intel-dev2devfeb
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Benjamin R. <ben...@ou...> - 2011年02月09日 22:36:33
On Wed, Feb 9, 2011 at 1:50 AM, Eric Firing <ef...@ha...> wrote:
> On 02/08/2011 02:39 PM, Christoph Gohlke wrote:
> >
>
> >
> > Please consider the attached patch for the _image.frombyte function. It
> > avoids temporary copies in case of non-contiguous input arrays. Copying
> > a 1024x1024 slice out of a contiguous 4096x4096 RGBA or RGB array is
> > about 7x faster (a common case for zooming/panning). Copying contiguous
> > RGB input arrays is ~2x faster. Tested on win32-py2.7.
> >
> > Christoph
> >
>
> Thank you!
>
> Looks good, speeds up zooming and panning on large images as advertised.
> An 8000x8000 image is actually manageable now.
> interpolation='nearest' is still very slow until the image is
> substantially zoomed, but everything is quite quick with other
> interpolation styles. The slowness of 'nearest' looks like a basic
> characteristic of the implementation.
>
> I committed the patch in 8966.
>
> Before that I found and committed a big speed-up in Normalize.
>
> Eric
>
>
Eric,
How much is the speed-up in Normalize? It might be worth it to apply it to
LogNorm as well. (as an aside, I find the duplication of code in Normalize
and friends a little disconcerting...).
Also, what would it take (if it is at all possible) to take advantage of
these image optimizations while using pcolor?
Ben Root
From: Michael R. <raw...@ya...> - 2011年02月09日 22:01:26
I'm trying to shade grids below a certain threshold a certain color. Using m.pcolor. Also would like to know more about how the routine I've been given, and am using using, (below) works. I'm fairly new to matplotlib so thanks for the help.
Looks like array is filled in these lines:
thevar='mean'
data=ncfile.variables[thevar]
dataa=data[:]
theshape=dataa.shape
Missing values I've chosen set here:
data.missing_value=0
try:
	mval=data.missing_value
	print " using specified missing value =",mval
except:
	mval=1.e30
	print " faking missing value=",mval
# make a masked array: using missing value(s) in mval
maskdat=ma.masked_values(slice,mval)
Map shading here, I believe:
p = m.pcolor(x,y,maskdat,shading='flat',cmap=mycolormap)
Questions. 1) How does the function know of the data array? Then, how would I shade grids, with values that are less than zero, purple?
Thanks!
Mike
-------------------------------------------------
verbose=0 #verbose=2 says a bit more
import sys,getopt
from mpl_toolkits.basemap import Basemap, shiftgrid, cm 
#from netCDF3 import Dataset as NetCDFFile 
from mpl_toolkits.basemap import NetCDFFile
from pylab import *
alloptions, otherargs= getopt.getopt(sys.argv[1:],'ro:p:X:Y:v:t:l:u:n:') # note the : after o and p
proj='lam'
#plotfile=None
#plotfile='testmap2.png'
usejetrev=False
colorbounds=[None,None]
extratext=""
xvar=None
yvar=None
thevar=None
#thetitle='Mean Snow Mass, January-March 1980s, HADCM3_HRM3'
#thetitle='Mean Snow Depth, January-March 1980s, CGCM3_CRCM'
#thetitle='Mean Snow Depth, January-March 2060s, CGCM3_CRCM'
#thetitle='Mean Snow Depth, January-March 1980s, CCSM_WRFG'
#thetitle='Mean Snow Depth, January-March 2060s, CCSM_WRFG'
#thetitle='Mean Snow Depth, January-March 1980s, HADCM3_HRM3'
#thetitle='Mean Snow Depth, January-March 2060s, HADCM3_HRM3'
#thetitle='Mean Snow Depth, January-March 1980s, MultiModel Mean'
thetitle='Mean Snow Depth, January-March 2060s, MultiModel Mean'
therec=None
thelev=None
cbot=None
ctop=None
startlon=-180 #default assumption for starting longitude
for theopt,thearg in alloptions:
	print theopt,thearg
	if theopt=='-o': # -o needs filename after it, which is now thearg
		plotfile=thearg	
	elif theopt=='-p': 
		proj=thearg
	elif theopt=='-X': 
		xvar=thearg
	elif theopt=='-Y': 
		yvar=thearg
	elif theopt=='-v': 
		thevar=thearg
	elif theopt=='-t': 
		thetitle=thearg
	elif theopt=='-l': 
		cbot=thearg
	elif theopt=='-u': 
		ctop=thearg
	elif theopt=='-n': 
		therec=thearg
	elif theopt=='-m': 
		thelev=thearg
	elif theopt=='-r': 
		usejetrev=True
	else: #something went wrong
		print "hmm, what are these??? ", theopt, thearg
		sys.exit()
print otherargs
try:
	ncname=otherargs[0]
	ncfile = NetCDFFile(ncname, 'r')
except:
#	ncname = raw_input("\nenter NetCDF file name =>")
#	ncfile = NetCDFFile(ncname, 'r')
	ncfile = NetCDFFile('simple_xy.nc', 'r') # Here's filename
	
if verbose>0: #examine the NetCDF file
	print "GLOBAL ATTRIBUTES:"
	allattr=dir(ncfile)
	normalattr=dir(NetCDFFile('/tmp/throwaway.nc','w'))
	for item in allattr:
		if item not in normalattr: print item,': ',getattr(ncfile,item)
#	for name in ncfile.ncattrs():
#			print name,'=', getattr(ncfile,name)
#			if name=='Conventions' and getattr(ncfile,name)=='COARDS':
#				nmcrean=True
#				startlon=0.
#				print "guessing this is an NMC reananalysis file"
#			else:
#				nmcrean=False
	print "\n\nDIMENSIONS:"
	for name in ncfile.dimensions.keys():
		print "\nDIMENSION:",
		try:
			print name, ncfile.variables[name][:]
		except:
			print name, ncfile.dimensions[name]
		try:
			print ' ',ncfile.variables[name].units
		except:
			pass
		try:
			print ' ',ncfile.variables[name].gridtype
		except:
			pass
	print "\n'*****************'\nVARIABLES:"
	for name in ncfile.variables.keys():
		if name in ncfile.dimensions.keys(): continue
		print "\nVARIABLE:",
		print name, ncfile.variables[name].dimensions,
		try:
			print ' ',ncfile.variables[name].units
		except:
			pass
		try:
			print " missing value=",ncfile.variables[name].missing_value
		except:
			pass
#
print "********************\n"
#if not xvar: xvar=raw_input("\nenter X variable=>")
xvar='rlon'
print "shape of "+xvar+': ',ncfile.variables[xvar].shape
if ncfile.variables[xvar][:].ndim ==1:
	print "X is independent of Y"
	lon1d=ncfile.variables[xvar][:]
else:
	lon1d=False
	if ncfile.variables[xvar][:].ndim ==2: lon2d=ncfile.variables[xvar][:]
	if ncfile.variables[xvar][:].ndim ==3: lon2d=ncfile.variables[xvar][0,:,:] #WRF
	print "shape of lond2d:", lon2d.shape
#print type(lon1d),lon1d,type(lon1d[1]),lon1d[1]
#
#if not yvar: yvar=raw_input("\nenter Y variable=>")
yvar='rlat'
print "shape of "+yvar+': ',ncfile.variables[yvar].shape
if ncfile.variables[yvar][:].ndim ==1:
	print "Y is independent of X"
	lat1d=ncfile.variables[yvar][:]
else:
	lat1d=False
	if ncfile.variables[yvar][:].ndim ==2: lat2d=ncfile.variables[yvar][:]
	if ncfile.variables[yvar][:].ndim ==3: lat2d=ncfile.variables[yvar][0,:,:] #WRF
	print "shape of lat2d:", lat2d.shape
#
#if not thevar: thevar=raw_input("\nenter variable to plot=>")
#thevar='nseasondays'
#thevar='diff'
thevar='mean'
data=ncfile.variables[thevar]
dataa=data[:]
theshape=dataa.shape
try:
	add_offset=ncfile.variables[thevar].add_offset
	print "will use add_offset=",add_offset
except:
	add_offset=0.	
print "shape of "+thevar+': ',theshape
if len(theshape)>2:
	print "there are apparently",theshape[0],"records"
	if not therec: therec=raw_input("enter record number to plot=>")
	therec=int(therec)
	extratext=" rec=%d" %therec
if len(theshape)>3:
	print "there are apparently",theshape[1],"levels"
	if not thelev: thelev=raw_input("enter level number to plot=>")
	thelev=int(thelev)
	extratext=extratext+" lev=%d" %thelev
if len(theshape)>3: 
	slice=dataa[therec,thelev,:,:]+add_offset
elif len(theshape)>2: 
	slice=dataa[therec,:,:]+add_offset
else:
	slice=dataa+add_offset
data.missing_value=0
#data.missing_value=-999
try:
	mval=data.missing_value
	print " using specified missing value =",mval
except:
	mval=1.e30
	print " faking missing value=",mval
# make a masked array: using missing value(s) in mval
maskdat=ma.masked_values(slice,mval)
datamax=max(maskdat.compressed().flat)
datamin=min(maskdat.compressed().flat)
print "\n"+thevar+" has maximum ", datamax," and minimum:", datamin
#colorbounds=[None,None]
#if not cbot: cbot=raw_input("enter lower bound on color scale =>")
#if cbot: colorbounds[0]=float(cbot)
#if not ctop: ctop=raw_input("enter upper bound on color scale =>")
#if ctop: colorbounds[1]=float(ctop)
#colorbounds=[-10,90] # for diff in days
colorbounds=[0,100] 
print "using clim=",colorbounds
#
# shift lons and lats by 1/2 grid increment (so values represent the vertices
# of the grid box surrounding the data value, as pcolor expects).
if type(lon1d)!=type(False): #lon1d does exist
	delon = lon1d[1]-lon1d[0]
	delat = lat1d[1]-lat1d[0]
	lons = zeros(len(lon1d)+1,'d')
	lats = zeros(len(lat1d)+1,'d')
	lons[0:len(lon1d)] = lon1d-0.5*delon
	lons[-1] = lon1d[-1]+0.5*delon
	lats[0:len(lat1d)] = lat1d-0.5*delon
	lats[-1] = lat1d[-1]+0.5*delon
	lons, lats = meshgrid(lons, lats)
else: 
	xdim,ydim=lon2d.shape
	lons=zeros([xdim+1,ydim+1],'d')
	lats=zeros([xdim+1,ydim+1],'d')
	for i in range(1,xdim):
		for j in range(1,ydim):
			lats[i,j]=.5*lat2d[i,j]+.5*lat2d[i-1,j-1] 		 
			lons[i,j]=.5*lon2d[i,j]+.5*lon2d[i-1,j-1] 		 
	for i in range(1,xdim):
		lons[i,-1]=-lons[i,-3]+2*lons[i,-2] 		 
		lats[i,-1]=-lats[i,-3]+2*lats[i,-2] 		 
		lons[i,0]=-lons[i,2]+2*lons[i,1] 		 
		lats[i,0]=-lats[i,2]+2*lats[i,1] 		 
	for j in range(ydim+1):
		lons[-1,j]=-lons[-3,j]+2*lons[-2,j] 		 
		lats[-1,j]=-lats[-3,j]+2*lats[-2,j] 		 
		lons[0,j]=2*lons[1,j]-lons[2,j] 		 
		lats[0,j]=2*lats[1,j]-lats[2,j] 		 
#
# alter a matplotlib color table, 
# cm.jet is very useful scheme, but reversed colors are better for drought 
colordict=cm.jet._segmentdata.copy() # dictionary ('blue', 'green', 'red') of nested tuples
for k in colordict.keys():
	colordict[k]=[list(q) for q in colordict[k]] #convert nested tuples to nested list
	for a in colordict[k]: 
		a[0]=1.-a[0] #in inner list, change normalized value to 1 - value.
	colordict[k].reverse() #reverse order of outer list
jetrev = cm.colors.LinearSegmentedColormap("jetrev", colordict)
# jetrev can now be used in place of cm.jet
#
# setup of basemap ('lcc' = lambert conformal conic).
# use major and minor sphere radii from WGS84 ellipsoid.
print "\nPlotting, please wait...maybe more than 10 seconds"
if proj=='lam': #Lambert Conformal
	m = Basemap(llcrnrlon=-118.0,llcrnrlat=24.,urcrnrlon=-60.0,urcrnrlat=48.0,\
 resolution='l',area_thresh=1000.,projection='lcc',\
 lat_1=70.,lon_0=-98.)
	xtxt=200000. #offset for text
	ytxt=200000.
	parallels = arange(20.,50.,10.)
#	meridians = arange(10.,360.,10.)
	meridians = arange(-130.,-50.,20.)
else: #cylindrical is default
#	m = Basemap(llcrnrlon=-180.,llcrnrlat=-90,urcrnrlon=180.,urcrnrlat=90.,\
# resolution='c',area_thresh=10000.,projection='cyl')
	m = Basemap(llcrnrlon=startlon,llcrnrlat=-90,urcrnrlon=startlon+360.,urcrnrlat=90.,\
 resolution='c',area_thresh=10000.,projection='cyl')
	xtxt=1.
	ytxt=0.
	parallels = arange(-90.,90.,30.)
	if startlon==-180:
		meridians = arange(-180.,180.,60.)
	else:
		meridians = arange(0.,360.,60.)
if verbose>1: print m.__doc__ 
xsize = rcParams['figure.figsize'][0]
fig=figure(figsize=(xsize,m.aspect*xsize))
ax = fig.add_axes([0.08,0.1,0.7,0.7],axisbg='white')
# make a pcolor plot.
x, y = m(lons, lats)
mycolormap=cm.jet
if usejetrev:
	mycolormap=jetrev
	print "using reverse of cm.jet"
p = m.pcolor(x,y,maskdat,shading='flat',cmap=mycolormap)
clim(*colorbounds)
cax = axes([0.85, 0.1, 0.05, 0.7]) # setup colorbar axes
#if datamax>1000.:
#	colorbar(format='%7.1e', cax=cax) # draw colorbar
#elif datamax>5.:
#	colorbar(format='%d', cax=cax) # draw colorbar
#else:
#	colorbar(format='%5.2f', cax=cax) # draw colorbar
colorbar(format='%d', cax=cax)
text(0.7,1.02,'mm')
axes(ax) # make the original axes current again
# plot blue dot on Norman OK and label it as such.
#if startlon==-180:
#	xpt,ypt = m(-97.4836,35.2556) 
#else:
#	xpt,ypt = m(-97.4836+360.,35.2556) 
#m.plot([xpt],[ypt],'bo') 
#text(xpt+xtxt,ypt+ytxt,'Norman')
# draw coastlines and political boundaries.
m.drawcoastlines()
m.drawcountries()
m.drawstates()
# draw parallels and meridians.
# label on left, right and bottom of map.
m.drawparallels(parallels,labels=[1,1,0,0])
m.drawmeridians(meridians,labels=[1,1,0,1])
if not thetitle:
	title(thevar+extratext)
else:
	title(thetitle)
	
#if plotfile:
#	savefig(plotfile, dpi=72, facecolor='w', bbox_inches='tight', edgecolor='w', orientation='portrait')
#else:
#	show()
plt.savefig('map.png')
# comment show to mass produce
 
 
____________________________________________________________________________________
Now that's room service! Choose from over 150,000 hotels
in 45,000 destinations on Yahoo! Travel to find your fit.
http://farechase.yahoo.com/promo-generic-14795097
From: Bruce F. <br...@cl...> - 2011年02月09日 21:56:45
I brute-forced this another way by dealing the arrays I had created.
Thanks for the suggestions!
---------------------------------------
Bruce W. Ford
Clear Science, Inc.
On Wed, Feb 9, 2011 at 10:30 AM, Jeff Whitaker <js...@fa...> wrote:
> On 2/9/11 7:51 AM, Bruce Ford wrote:
> > I am attempting to plot a line atop a basemap instance called "m". I
> > can do this without a problem with:
> >
> > plot = m.plot(lon,lat,'r-') #lon and lat are lists
> >
> > However, I'd like to color the line based on a third list called
> > "intensity." For instance, if the value of intensity between two
> > points is 0-35 make it green, 35-70 make it yellow, etc.
> >
> > I have studied this example:
> > http://www.scipy.org/Cookbook/Matplotlib/MulticoloredLine but I cannot
> > get a collection added to the figure without errors.
> >
> > Has anyone done similar?
> >
> > Thanks!
>
> Bruce: Can you show us how you are doing it (and what the error message
> is)? You should just be able to add the line collection to the axes
> instance that the Basemap instance is drawing on.
>
> -J
>
> --
> 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-113
> Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
>
>
>
> ------------------------------------------------------------------------------
> The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
> Pinpoint memory and threading errors before they happen.
> Find and fix more than 250 security defects in the development cycle.
> Locate bottlenecks in serial and parallel code that limit performance.
> http://p.sf.net/sfu/intel-dev2devfeb
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Aman T. <ama...@gm...> - 2011年02月09日 21:54:23
Hi,
I was just wondering, how would I go about redrawing only a single element
(i.e. an artist)? I know that matplotlib.artist.Artist has a draw() method
that accepts a renderer as the argument.
I tried something along the lines of:
renderer = fig.canvas.get_renderer()
title = ax.set_title("This is my title")
title.draw(renderer)
But have not had any luck. I'm not sure what I'm missing. Any help would
be greatly appreciated.
Thanks,
Aman
From: Curiouslearn <cur...@gm...> - 2011年02月09日 20:32:57
Can you please see the code below and let me know why the png figure
comes out empty (it only contains the x-axis, does not contain the
scatterplot). The pdf file has no such problems.
I have tried saving another usual line plot in .png format and I had
no problems. Does this have to do with scatter plot and .png format?
Thank you.
The code
import matplotlib.pyplot as plt
import numpy
differences = numpy.random.uniform(-2,2,190)
bin_values = numpy.arange(-2,2.6,0.1)
hist, bins = numpy.histogram(differences, bins = bin_values)
fig1 = plt.figure()
fig1.set_figwidth(6)
fig1.set_figheight(3)
ax1 = fig1.add_axes([0.1, 0.3, 0.8, 0.9])
ax1.patch.set_facecolor('Linen')
for left, hist_val in zip(bins[:-1], hist):
 xvec = [left]*hist_val
 yvec = 0.05*numpy.arange(hist_val) + 0.1
 if len(xvec) > 0:
 ax1.scatter(xvec,yvec)
ax1.axvline(1.3, ymax=0.6, color='DarkGreen')
# The frame of the axes is referred to as
# spines in matplotlib
for i in ax1.spines.iteritems():
 if i[0] in ['top','right', 'left']:
 i[1].set_visible(False)
 print i
# Ticks only in bottom
ax1.xaxis.set_ticks_position('bottom')
ax1.yaxis.set_ticks_position('none')
ax1.set_ylim(bottom=0,top=1.5)
fig1.savefig('trial_figure.png', facecolor='Linen')
fig1.savefig('trial_figure.pdf', facecolor='Linen')
From: neurino <ne...@gm...> - 2011年02月09日 20:30:12
Thank you very much, that can help for sure!
Unluckily matplotlib documentation is rather a jungle, just the lack of a
methods/properties index for each class makes very hard to find what one's
looking for.
Thanks again.
Greetings
neurino
2011年2月9日 Benjamin Root <ben...@ou...>
> On Wed, Feb 9, 2011 at 6:47 AM, neurino <ne...@gm...> wrote:
>
>> Well, not that automatic...
>>
>> I wonder why matplotlib takes care of settings limits on data but fails in
>> a common situation so I'm forced to override it every time because I don't
>> know in advance what data I get...
>>
>> Thanks anyway.
>>
>> Cheers
>> neurino
>>
>>
> I did a little digging and I discovered a function I never noticed
> before... You can set a "margin" for an axis that can be used for
> autoscaling purposes.
>
> set_ymargin(self, m) method of matplotlib.axes.AxesSubplot instance
> Set padding of Y data limits prior to autoscaling.
>
> *m* times the data interval will be added to each
> end of that interval before it is used in autoscaling.
>
> accepts: float in range 0 to 1
>
> So, in your code, if I set ymargin to 0.5, then the limits will
> automatically be -0.5 to 1.5.
>
> I think this is what you are looking for.
>
> Ben Root
>
>
From: Paul I. <piv...@gm...> - 2011年02月09日 20:23:44
Alejandro Weinstein, on 2011年02月09日 13:01, wrote:
> Hi:
> 
> Any suggestion for making a stair plot in Matplotlib (like the stairs
> function in Matlab)?
> 
> The attached figure is the output of the following Matlab commands:
> 
> x = 0:10;
> stairs(x);
> 
> I guess it is a matter of using a zero-order hold interpolation rather
> than linear interpolation between the points in the plot command, but
> I haven't find how to do that.
Hi Alejandro,
no need for interpolation - just use plt.step:
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(10)
plt.step(x,x)
you might also want to play with step's "where" parameter for
slightly different behavior of where the transition between the
steps occurs.
best,
-- 
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 
From: Alan G I. <ala...@gm...> - 2011年02月09日 20:13:27
You could use econpy's step_pts function:
http://code.google.com/p/econpy/source/browse/trunk/pytrix/pytrix.py
fwiw,
Alan Isaac
From: Alejandro W. <ale...@gm...> - 2011年02月09日 20:01:46
Attachments: stairs.png
Hi:
Any suggestion for making a stair plot in Matplotlib (like the stairs
function in Matlab)?
The attached figure is the output of the following Matlab commands:
x = 0:10;
stairs(x);
I guess it is a matter of using a zero-order hold interpolation rather
than linear interpolation between the points in the plot command, but
I haven't find how to do that.
Alejandro.
Dear Benjamin.
Okay. Now I attached almost the same zoomed region but zoomed twice to a 
very tiny area thus you can see that even the minor tickers have 
vanished on the y-axis.
My question: how do I need to set the y-axis minor (probably major 
tickers, too) to see anything from the grid as well as the tickers itself.
Kindly regards,
Thore
Benjamin Root schrieb:
> On Wed, Feb 9, 2011 at 1:17 PM, Thore Oltersdorf <
> tho...@is...> wrote:
> 
>> Dear Benjamin.
>>
>> Attached you find the same graph as for the other problem regarding the
>> inline annotations. But now zoomed once to reproduce the correctly scaled
>> x-axis but not autoscaled y-axis.
>>
>> Kindly regards,
>> Thore
>>
>>
>>
> Thore,
> 
> I do not see a problem with the attached graph. The graph looks correct to
> me. How is it different from what you expected to see?
> 
> Ben Root
> 
-- 
Dipl.-Ing. Thore Oltersdorf
Solar Building Group
Dept. Thermal Systems and Buildings
Fraunhofer-Institut für Solare Energiesysteme ISE
Heidenhofstrasse 2, 79110 Freiburg, Germany
Phone: +49 (0)761/4588-5239 Fax: +49 (0)761/4588-9239
thore.oltersdorf--<1!at!1>--ise.fraunhofer.de
http://www.ise.fraunhofer.de
http://HLK.ise.fraunhofer.de
From: Benjamin R. <ben...@ou...> - 2011年02月09日 19:28:39
On Wed, Feb 9, 2011 at 1:17 PM, Thore Oltersdorf <
tho...@is...> wrote:
> Dear Benjamin.
>
> Attached you find the same graph as for the other problem regarding the
> inline annotations. But now zoomed once to reproduce the correctly scaled
> x-axis but not autoscaled y-axis.
>
> Kindly regards,
> Thore
>
>
>
Thore,
I do not see a problem with the attached graph. The graph looks correct to
me. How is it different from what you expected to see?
Ben Root
Dear Benjamin.
Attached you find the same graph as for the other problem regarding the 
inline annotations. But now zoomed once to reproduce the correctly 
scaled x-axis but not autoscaled y-axis.
Kindly regards,
Thore
Benjamin Root schrieb:
> On Wed, Feb 9, 2011 at 5:08 AM, Thore Oltersdorf <
> tho...@is...> wrote:
> 
>> Dear Matplotlib-Users.
>>
>> After changing the scaling from the y-axis from default to semilogy the
>> tickers were not updated anymore automatically when a zoom is applied.
>>
>> Even after deep searches within the ticker API as well as the mail
>> archive list I could not find an appropriate solution for this.
>>
>> In the original artist/image (sorry for confused usage of this termini,
>> I am pretty new to matplotlib): the scale has a default log10-base with
>> major tickers including labels and minor tickers without (guess this is
>> the default ticker formatting).
>>
>> I was messing around a lot with autoscale(enable=True,axis='both') and
>> set_autoscale_on(True) and relim(). But actually the sovereign handling
>> ot this API is still missing for me and I was not able to solve the
>> problem.
>>
>> Thanks in advance for your help.
>>
>> Kindly regards,
>> Thore Oltersdorf
>>
>>
> Thore,
> 
> I cannot reproduce your problem as I understand it. Could you please attach
> a copy of the image that shows the incorrect labeling?
> 
> Ben Root
> 
-- 
Dipl.-Ing. Thore Oltersdorf
Solar Building Group
Dept. Thermal Systems and Buildings
Fraunhofer-Institut für Solare Energiesysteme ISE
Heidenhofstrasse 2, 79110 Freiburg, Germany
Phone: +49 (0)761/4588-5239 Fax: +49 (0)761/4588-9239
thore.oltersdorf--<1!at!1>--ise.fraunhofer.de
http://www.ise.fraunhofer.de
http://HLK.ise.fraunhofer.de
From: Thore O. <tho...@is...> - 2011年02月09日 19:13:43
Hi Benjamin.
Thanks for your help. Next to the attached "target" you find attached 
now the actual state of the isolines I have so far. It's already pretty 
fast plotted since I use now scipy.io.loadmat for generating and storing 
the isolines separated from the usage of matplotlib.
The "inline" annotation as you describe it is the first idea I had when 
I saw the attached screenshot from my first post. But this could cover 
any data points. Thus I had the idea to put the "annotations" as much as 
possible to the "end" of the isolines / the image. But then for better 
readability it would be great to have it on both ends. Otherwise it's 
like a labyrinth by trying to follow the correct isoline.
But I would be satisfied by any(!) solution. It's possible to live with 
inline annotation by putting them to physically unrealistic regions of 
pressure/temperature.
Kindly regards,
Thore
Benjamin Root schrieb:
> On Wed, Feb 9, 2011 at 5:18 AM, Thore Oltersdorf <
> tho...@is...> wrote:
> 
>> Dear Matplotlib-Users.
>>
>> I try to generate some 2d plot with dimension log10(p)-h from refprop.
>> For the isolines (isentropes, isotherms, isochores etc.) I was successful
>> but adding labels to these isolines were quite discouraging until now.
>> Please have a view on the screenshot to have an idea of the feature I try to
>> realize.
>>
>> I tried to find a similar feature as given in the contour API for the
>> clabel. There it is possible to define something like an inline label.
>>
>> (Of course I could have done this job with contour plots from the
>> beginnings. But please no hints like this. It would mean to begin from
>> scratch again...)
>>
>> Then I had the idea to generate points directly at the limits of the x- and
>> y-axis on each isoline to use it for an annotate instance. But it would mean
>> to annotate in the ticker region which is in a layer on top of the
>> graph/image. Later I wanted to set markeredgewidth and markersize to zero
>> just to have annotation as the feature of choice.
>>
>> Now I am not sure how to procede and hope that someone of you has an idea.
>>
>> Thanks in advance for your help.
>>
>> Kindly regards,
>> Thore Oltersdorf
>>
>>
> Thore,
> 
> I think I understand what you are asking, but I would like to make sure. If
> I understand you correctly, you are able to make all of your lines, but you
> want to annotate them within the graph? In addition, are you trying to
> label the lines so that the line is interrupted where there is text?
> 
> It would also be useful if you could attach an image of what you have
> managed to accomplish so far.
> 
> Ben Root
> 
-- 
Dipl.-Ing. Thore Oltersdorf
Solar Building Group
Dept. Thermal Systems and Buildings
Fraunhofer-Institut für Solare Energiesysteme ISE
Heidenhofstrasse 2, 79110 Freiburg, Germany
Phone: +49 (0)761/4588-5239 Fax: +49 (0)761/4588-9239
thore.oltersdorf--<1!at!1>--ise.fraunhofer.de
http://www.ise.fraunhofer.de
http://HLK.ise.fraunhofer.de
From: Benjamin R. <ben...@ou...> - 2011年02月09日 17:55:22
On Wed, Feb 9, 2011 at 5:08 AM, Thore Oltersdorf <
tho...@is...> wrote:
> Dear Matplotlib-Users.
>
> After changing the scaling from the y-axis from default to semilogy the
> tickers were not updated anymore automatically when a zoom is applied.
>
> Even after deep searches within the ticker API as well as the mail
> archive list I could not find an appropriate solution for this.
>
> In the original artist/image (sorry for confused usage of this termini,
> I am pretty new to matplotlib): the scale has a default log10-base with
> major tickers including labels and minor tickers without (guess this is
> the default ticker formatting).
>
> I was messing around a lot with autoscale(enable=True,axis='both') and
> set_autoscale_on(True) and relim(). But actually the sovereign handling
> ot this API is still missing for me and I was not able to solve the
> problem.
>
> Thanks in advance for your help.
>
> Kindly regards,
> Thore Oltersdorf
>
>
Thore,
I cannot reproduce your problem as I understand it. Could you please attach
a copy of the image that shows the incorrect labeling?
Ben Root
From: Benjamin R. <ben...@ou...> - 2011年02月09日 17:20:37
On Wed, Feb 9, 2011 at 5:18 AM, Thore Oltersdorf <
tho...@is...> wrote:
> Dear Matplotlib-Users.
>
> I try to generate some 2d plot with dimension log10(p)-h from refprop.
> For the isolines (isentropes, isotherms, isochores etc.) I was successful
> but adding labels to these isolines were quite discouraging until now.
> Please have a view on the screenshot to have an idea of the feature I try to
> realize.
>
> I tried to find a similar feature as given in the contour API for the
> clabel. There it is possible to define something like an inline label.
>
> (Of course I could have done this job with contour plots from the
> beginnings. But please no hints like this. It would mean to begin from
> scratch again...)
>
> Then I had the idea to generate points directly at the limits of the x- and
> y-axis on each isoline to use it for an annotate instance. But it would mean
> to annotate in the ticker region which is in a layer on top of the
> graph/image. Later I wanted to set markeredgewidth and markersize to zero
> just to have annotation as the feature of choice.
>
> Now I am not sure how to procede and hope that someone of you has an idea.
>
> Thanks in advance for your help.
>
> Kindly regards,
> Thore Oltersdorf
>
>
Thore,
I think I understand what you are asking, but I would like to make sure. If
I understand you correctly, you are able to make all of your lines, but you
want to annotate them within the graph? In addition, are you trying to
label the lines so that the line is interrupted where there is text?
It would also be useful if you could attach an image of what you have
managed to accomplish so far.
Ben Root
From: Benjamin R. <ben...@ou...> - 2011年02月09日 16:59:44
On Wed, Feb 9, 2011 at 6:47 AM, neurino <ne...@gm...> wrote:
> Well, not that automatic...
>
> I wonder why matplotlib takes care of settings limits on data but fails in
> a common situation so I'm forced to override it every time because I don't
> know in advance what data I get...
>
> Thanks anyway.
>
> Cheers
> neurino
>
>
I did a little digging and I discovered a function I never noticed
before... You can set a "margin" for an axis that can be used for
autoscaling purposes.
set_ymargin(self, m) method of matplotlib.axes.AxesSubplot instance
 Set padding of Y data limits prior to autoscaling.
 *m* times the data interval will be added to each
 end of that interval before it is used in autoscaling.
 accepts: float in range 0 to 1
So, in your code, if I set ymargin to 0.5, then the limits will
automatically be -0.5 to 1.5.
I think this is what you are looking for.
Ben Root
From: Jeff W. <js...@fa...> - 2011年02月09日 16:30:49
On 2/9/11 7:51 AM, Bruce Ford wrote:
> I am attempting to plot a line atop a basemap instance called "m". I 
> can do this without a problem with:
>
> plot = m.plot(lon,lat,'r-') #lon and lat are lists
>
> However, I'd like to color the line based on a third list called 
> "intensity." For instance, if the value of intensity between two 
> points is 0-35 make it green, 35-70 make it yellow, etc.
>
> I have studied this example: 
> http://www.scipy.org/Cookbook/Matplotlib/MulticoloredLine but I cannot 
> get a collection added to the figure without errors.
>
> Has anyone done similar?
>
> Thanks!
Bruce: Can you show us how you are doing it (and what the error message 
is)? You should just be able to add the line collection to the axes 
instance that the Basemap instance is drawing on.
-J
-- 
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-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: Thore O. <tho...@is...> - 2011年02月09日 16:27:00
Dear Thomas.
Thanks again for your reply.
I have tried your solution of putting the logo-file into
the folder %HOME% on my Windows system. Actually what happened
is that after invocation of the script the file vanished into the nowhere...
I couldn't see any change in the error output otherwise I would post it 
here.
Kindly regards,
Thore
PS: Thanks for your hint regarding the multiple post. It was
a stupid mistake and I promise it will never happen again. Sorry again 
to all annoyed readers.
Thomas Lecocq schrieb:
> matplotlib.cbook documentation :
> 
> http://matplotlib.sourceforge.net/api/cbook_api.html?highlight=matplotlib.cbook#matplotlib.cbook.get_sample_data
> 
> 
> matplotlib.cbook.get_sample_data(fname, asfileobj=True)¶
> 
> Check the cachedirectory ~/.matplotlib/sample_data for a sample_data file. If it does not exist, fetch it with urllib from the mpl svn repo
> http://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/sample_data/
> and store it in the cachedir.
> If asfileobj is True, a file object will be returned. Else the path to the file as a string will be returned
> To add a datafile to this directory, you need to check out sample_data from matplotlib svn:
> svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/sample_data
> and svn add the data file you want to support. This is primarily intended for use in mpl examples that need custom data.
> To bypass all downloading, set the rc parameter examples.download to False and examples.directory to the directory where we should look.
> 
> So, you have to have the logo.png image in the $home$/matplotlib/sample_data. If it is not present there, the script will try to download it from the server.
> 
> 
> Thomas
> 
> ps : emailing 3 times the same question doesn't make the answer come faster.
> 
> **********************
> Thomas Lecocq 
> Geologist
> Ph.D.Student (Seismology)
> Royal Observatory of Belgium
> **********************
> 
> 
> 
>> Date: Wed, 9 Feb 2011 12:27:21 +0100
>> From: tho...@is...
>> To: mat...@li...
>> Subject: [Matplotlib-users] Trouble with api example code within watermark_image.py
>>
>> Dear Developers of Matplotlib,
>>
>> at first thanks for this mightiest tool for graphical output from python 
>> data. I have encountered problems on trying the watermark feature as 
>> described at 
>> http://matplotlib.sourceforge.net/examples/api/watermark_image.html.
>>
>> When I invoke the script from a Enthought Python Compiler in the Windows 
>> COM then I got this message:
>>
>> Traceback (most recent call last):
>> File "Fluide\script1.py", line 13, in <module>
>> datafile = cbook.get_sample_data('logo.png', asfileobj=False)
>> File 
>> "D:\Programme\Enthought\lib\site-packages\matplotlib-1.0.1_r0-py2.6-win32.egg\matplotlib\cbook.py", 
>> line 676, in get_sample_data
>> return myserver.get_sample_data(fname, asfileobj=asfileobj)
>> File 
>> "D:\Programme\Enthought\lib\site-packages\matplotlib-1.0.1_r0-py2.6-win32.egg\matplotlib\cbook.py", 
>> line 623, in get_sample_data
>> raise KeyError(msg)
>> KeyError: 'file iselogo.png not in cache; received <urlopen error [Errno 
>> 10061] No connection could be made because the target machine actively 
>> refused it> when trying to retrieve'
>>
>> Does anyone no a solution for this problem? Image is in the same 
>> directory as the script. Or if now I switched to it by os.chdir to the 
>> specific path.
>>
>> Thanks in advance for your help.
>>
>> Kindly regards,
>> Thore Oltersdorf
>>
>> ------------------------------------------------------------------------------
>> The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
>> Pinpoint memory and threading errors before they happen.
>> Find and fix more than 250 security defects in the development cycle.
>> Locate bottlenecks in serial and parallel code that limit performance.
>> http://p.sf.net/sfu/intel-dev2devfeb
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 		 	 		 
-- 
Dipl.-Ing. Thore Oltersdorf
Solar Building Group
Dept. Thermal Systems and Buildings
Fraunhofer-Institut für Solare Energiesysteme ISE
Heidenhofstrasse 2, 79110 Freiburg, Germany
Phone: +49 (0)761/4588-5239 Fax: +49 (0)761/4588-9239
thore.oltersdorf--<1!at!1>--ise.fraunhofer.de
http://www.ise.fraunhofer.de
http://HLK.ise.fraunhofer.de
From: Thomas L. <thl...@ms...> - 2011年02月09日 16:00:45
Bruce,
From: br...@cl...
Date: Wed, 9 Feb 2011 09:51:06 -0500
To: mat...@li...
Subject: [Matplotlib-users] Plotting multi-colored lines atop basemap instances
I am attempting to plot a line atop a basemap instance called "m". I can do this without a problem with:
plot = m.plot(lon,lat,'r-') #lon and lat are lists
However, I'd like to color the line based on a third list called "intensity." For instance, if the value of intensity between two points is 0-35 make it green, 35-70 make it yellow, etc.
I have studied this example: http://www.scipy.org/Cookbook/Matplotlib/MulticoloredLine but I cannot get a collection added to the figure without errors.
 
You can always use 'regular' pyplot methods on your plot :
 
fig = plt.figure()
ax = fig.subplot(111)
 
m = Basemap(etc....)
 
 
convert your lon/lat to X,Y in the basemap projection: 
X,Y = m(lon,lat)
 
then plot your line as if you were using only pyplot :
 
plt.plot(X,Y) 
 
 
This way, you can add the collection as 
 
ax.add_collection(somecollection)
 
 
HTH,
 
Thomas 		 	 		 
From: Bruce F. <br...@cl...> - 2011年02月09日 15:21:07
I am attempting to plot a line atop a basemap instance called "m". I can do
this without a problem with:
plot = m.plot(lon,lat,'r-') #lon and lat are lists
However, I'd like to color the line based on a third list called
"intensity." For instance, if the value of intensity between two points is
0-35 make it green, 35-70 make it yellow, etc.
I have studied this example:
http://www.scipy.org/Cookbook/Matplotlib/MulticoloredLine but I cannot get a
collection added to the figure without errors.
Has anyone done similar?
Thanks!
---------------------------------------
Bruce W. Ford
Clear Science, Inc.
From: Thomas L. <thl...@ms...> - 2011年02月09日 12:53:02
Neurino
 
I'm sure :
 
1° there must be a parameter in the default behaviour of the subplot to control taht
2° you can always set xlim( min(X)/2, max(X)/2 ) ...
 
Thomas
**********************
Thomas Lecocq 
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************
 
Date: Wed, 9 Feb 2011 13:47:01 +0100
Subject: Re: [Matplotlib-users] Best way to set scales bounds to appropriate values
From: ne...@gm...
To: thl...@ms...
CC: mat...@li...
Well, not that automatic...
I wonder why matplotlib takes care of settings limits on data but fails in a common situation so I'm forced to override it every time because I don't know in advance what data I get...
Thanks anyway.
Cheers
neurino
2011年2月9日 Thomas Lecocq <thl...@ms...>
This will do :
 
pyplot.xlim(-5,15)
pyplot.ylim(-5,5)
 
 
HTH.
 
Thomas
**********************
Thomas Lecocq 
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************
 
Date: Wed, 9 Feb 2011 11:53:17 +0100
From: ne...@gm...
To: mat...@li...
Subject: [Matplotlib-users] Best way to set scales bounds to appropriate values
Hi, I'm a matplotlib newbie. 
An example is worth a thousand words:
In [1]: matplotlib.__version__ 
Out[1]: '0.99.3'
In [2]: a, b, x = np.zeros(10), np.ones(10), np.arange(10)
In [3]: plot(x, a); plot(x, b)
Well all I see is an empty plot with the two horizontal lines at y=0 and y=1 covered by the upper and lower frame lines.
Why aren't bounds set a little more larger so the two lines can show properly???
I guess this is a common situation, for example 2 or more stable temperatures: the higher and the lower never show...
How can I fix it?
Thanks for your support.
------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________ Matplotlib-users mailing list Mat...@li... https://lists.sourceforge.net/lists/listinfo/matplotlib-users 
 		 	 		 
From: neurino <ne...@gm...> - 2011年02月09日 12:47:07
Well, not that automatic...
I wonder why matplotlib takes care of settings limits on data but fails in a
common situation so I'm forced to override it every time because I don't
know in advance what data I get...
Thanks anyway.
Cheers
neurino
2011年2月9日 Thomas Lecocq <thl...@ms...>
> This will do :
>
> pyplot.xlim(-5,15)
> pyplot.ylim(-5,5)
>
>
> HTH.
>
> Thomas
>
> **********************
> Thomas Lecocq
> Geologist
> Ph.D.Student (Seismology)
> Royal Observatory of Belgium
> **********************
>
>
>
> ------------------------------
> Date: Wed, 9 Feb 2011 11:53:17 +0100
> From: ne...@gm...
> To: mat...@li...
> Subject: [Matplotlib-users] Best way to set scales bounds to appropriate
> values
>
>
> Hi, I'm a matplotlib newbie.
>
> An example is worth a thousand words:
>
> In [1]: matplotlib.__version__
> Out[1]: '0.99.3'
>
> In [2]: a, b, x = np.zeros(10), np.ones(10), np.arange(10)
>
> In [3]: plot(x, a); plot(x, b)
>
> Well all I see is an empty plot with the two horizontal lines at y=0 and
> y=1 covered by the upper and lower frame lines.
>
> Why aren't bounds set a little more larger so the two lines can show
> properly???
> I guess this is a common situation, for example 2 or more stable
> temperatures: the higher and the lower never show...
>
> How can I fix it?
>
> Thanks for your support.
>
> ------------------------------------------------------------------------------
> The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
> Pinpoint memory and threading errors before they happen. Find and fix more
> than 250 security defects in the development cycle. Locate bottlenecks in
> serial and parallel code that limit performance.
> http://p.sf.net/sfu/intel-dev2devfeb
> _______________________________________________ Matplotlib-users mailing
> list Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Thomas L. <thl...@ms...> - 2011年02月09日 12:23:54
This will do :
 
pyplot.xlim(-5,15)
pyplot.ylim(-5,5)
 
 
HTH.
 
Thomas
**********************
Thomas Lecocq 
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************
 
Date: Wed, 9 Feb 2011 11:53:17 +0100
From: ne...@gm...
To: mat...@li...
Subject: [Matplotlib-users] Best way to set scales bounds to appropriate values
Hi, I'm a matplotlib newbie.
An example is worth a thousand words:
In [1]: matplotlib.__version__ 
Out[1]: '0.99.3'
In [2]: a, b, x = np.zeros(10), np.ones(10), np.arange(10)
In [3]: plot(x, a); plot(x, b)
Well all I see is an empty plot with the two horizontal lines at y=0 and y=1 covered by the upper and lower frame lines.
Why aren't bounds set a little more larger so the two lines can show properly???
I guess this is a common situation, for example 2 or more stable temperatures: the higher and the lower never show...
How can I fix it?
Thanks for your support.
------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________ Matplotlib-users mailing list Mat...@li... https://lists.sourceforge.net/lists/listinfo/matplotlib-users 		 	 		 

Showing results of 39

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