Wie Sie festlegen, xlim in python matplotlib pyplot?
Habe ich diesen code:
import matplotlib.pyplot as pl
pl.plot(np.log(alphas_lasso),coefs_lasso.T) #this generate a plot which xlim=[-8,-2]
for alpha in alpha_min:
pl.axvline(np.log(alpha),0,1) #add vertical line for every value of alpha
pl.xlim([-10,0]) # the xlim value I would like to set
pl.xlabel('Log(alpha)')
pl.ylabel('coefficients')
pl.title('Lasso Path')
pl.axis('tight')
pl.show()
print "log(alpha_min)=",log(alpha_min)
Es funktioniert, aber die x-Achse geht von -8 bis -2 aus, während ich würde gerne von -10 bis 0 Wo ist der Fehler???
InformationsquelleAutor Donbeo | 2013-12-02
Du musst angemeldet sein, um einen Kommentar abzugeben.
Legen Sie wieder Ihre xrange standardmäßig mit
pl.axis('tight')
. Versuchen Sie, entfernen Sie diese Zeile, oder legen Sie es vor diexlim
Befehl.Den pyplot Dokumentation sagt für
pl.axis('tight')
:"änderungen der x-und y-Achse begrenzt, so dass alle Daten angezeigt werden."
InformationsquelleAutor leeladam