Dies ist mein Code zum Zeichnen eines Graphen mit Residuen; Allerdings habe ich meine Tick-Nummern auf der X-Achse verloren und weiß nicht, wie ich sie zurückbekomme ... Jede Hilfe wäre sehr willkommen. Und wenn die Formatierung dieses Threads falsch ist, ist es meine erste.Ich habe die Zahlen auf den X-Ticks meiner Grafik verloren, wie bekomme ich sie zurück?
Code:
pyplot.figure()
fig1 = plt.figure(1)
frame1=fig1.add_axes((.1,.3,.8,.6))
pyplot.errorbar(xval, yval, yerr=yerr, xerr=xerr, marker='o',markersize = 2, linestyle='None', color = 'black')
# Axis labels
pyplot.xlabel(' Height (m)')
pyplot.ylabel('Mass per second (kg.s-1)')
# Generate best fit line using model function and best fit parameters, and add to plot
fit_line=model_funct(xval, [a_soln, b_soln])
# Theoretical line
x = np.array(arange(0.07,0.15, 0.001))
y = (-2.61049E-05) + (0.005815772)*x
plt.plot(x, y, linestyle = '--', color ='r',linewidth = 0.7, label = 'Theoretical')
# Experimental line
s = (-4.43329E-05) + (0.006008837)*x
pyplot.plot(x, s,linewidth = 0.7, color = 'black', label = 'Experimental Chi Squared Fit')
# Set suitable axis limits: you will probably need to change these...
pyplot.xlim(0.08, 0.14)
pyplot.ylim(0.0004, 0.0008)
pyplot.legend(loc = 'upper left',prop={'size':10})
frame2=fig1.add_axes((.1,.1,.8,.2))
difference = y - s
pyplot.plot(x, difference, color = 'black')
frame2.set_ylabel('Residual')
plt.xlabel('Height (m)')
plt.yticks(numpy.arange(-0.000010, 0.000010, 0.00001))
plt.xticks(numpy.arange(0.08, 0.14, 0.01))
pyplot.ylim(-0.000010, 0.000010)
pyplot.xlim(0.08,0.14)
pyplot.grid()
pyplot.show()
Es wäre hilfreich, wenn Sie ein kleines Beispiel dafür, Arbeitscode (https://stackoverflow.com/help/mcve) Der von Ihnen bereitgestellte Code wird mit Formatierungen gemischt, enthält keine 'import' Anweisungen und verweist auf undefinierte Variablen wie' xval'. – Gus