Hello,
I'm new to this forum, so please forgive me if I'm fogetting any
information.
I use python 2.5 and matplotlib version 0.91.2.0005.
I'm plotting data that I get out of a database, which works fine. The only
thing that doesn't work, although it works with any other simple plot, is
the xlim()- and ylim()-function.
My (simplified) code is:
···
#######################################
import MySQLdb
import beamfpy
import os
from scipy.io import *
from pylab import *
from numpy import *
from scipy import *
from matplotlib.cm import ScalarMappable
conn = MySQLdb.connect (host = "localhost",
user = "root",
db = "some_database")
cursor = conn.cursor()
krit='''
SELECT xxx
FROM xxx
WHERE xxx
ORDER xxx
'''
# text-properties
ts=7
rc('font', family='sans-serif',size=ts)
rc('axes', labelsize=ts)
#~ rc('lines', mew=1.0)
rc('xtick',labelsize=ts)
rc('ytick',labelsize=ts)
# plot-properties
lw=0.4
ms=1.0
for id in (7,8,9,10,11):
cursor.execute(krit,(str(id)))
ergall=cursor.fetchall()
value1=array(map(lambda x:float(x[0]),ergall))
value2=array(map(lambda x:float(x[1]),ergall))
figure(1,figsize=(8.4/2.56,0.75*8.4/2.56))
plot(value1,value2,'.-k',linewidth=lw,markersize=ms)
ylim(-9,13)
xlim(-2,25)
if id==7:
for i in range(len(value1)):
if L[i]>=0:
text(value1[i]-1.8,value2[i]+0.2,str(value1)+u'°',color='r',fontsize=ts-2)
else:
text(value1[i]-1.6,value2[i]-1.8,str(value1)+u'°',color='r',fontsize=ts-2)
xlabel('$c_{d,n}$',fontsize=ts)
ylabel('$c_{l,n}$',fontsize=ts)
ylim(-9,13)
xlim(-2,25)
axhline(color='k')
gca().set_position([0.15,0.17,0.75,0.75])
filename='Fig1.eps'
savefig(filename)
os.system("epstopdf "+filename)
cursor.close()
conn.close()
show()
#####################################################
As you see, I even call the xlim()- and ylim()-functions twice, once in the
loop and the second time outside the loop. I tried both versions, too, but
nothing worked.
Can you help me?
Thank you very much!
CliftonH
--
View this message in context: http://www.nabble.com/ylim-does-not-work-tp19000814p19000814.html
Sent from the matplotlib - users mailing list archive at Nabble.com.