[plotstyle] set_[xyz]label() functions are set as members of axes

This commit is contained in:
2020-01-04 18:32:52 +01:00
parent 1432d4fcd2
commit c49047fa67
10 changed files with 106 additions and 50 deletions

View File

@@ -21,8 +21,8 @@ if __name__ == "__main__":
ax1 = fig.add_subplot(spec[0, 0])
show_spines(ax1, 'lb')
ax1.scatter(indices, data, c=colors['blue'], edgecolor='white', s=50)
set_xlabel(ax1, 'Index')
set_ylabel(ax1, 'Weight', 'kg')
ax1.set_xlabel('Index')
ax1.set_ylabel('Weight', 'kg')
ax1.set_xlim(-10, 310)
ax1.set_ylim(0, 370)
ax1.set_yticks(np.arange(0, 351, 100))
@@ -35,7 +35,7 @@ if __name__ == "__main__":
bw = 20.0
h, b = np.histogram(data, np.arange(0, 401, bw))
ax2.barh(b[:-1], h/np.sum(h)/(b[1]-b[0]), fc=colors['yellow'], height=bar_fac*bw, align='edge')
set_xlabel(ax2, 'Pdf', '1/kg')
ax2.set_xlabel('Pdf', '1/kg')
ax2.set_xlim(0, 0.012)
ax2.set_xticks([0, 0.005, 0.01])
ax2.set_xticklabels(['0', '0.005', '0.01'])

View File

@@ -26,8 +26,8 @@ if __name__ == "__main__":
show_spines(ax1, 'lb')
ax1.plot(xx, yy, colors['red'], lw=2)
ax1.scatter(x, y, c=colors['blue'], edgecolor='white', s=50)
set_xlabel(ax1, 'Hair deflection', 'nm')
set_ylabel(ax1, 'Conductance', 'nS')
ax1.set_xlabel('Hair deflection', 'nm')
ax1.set_ylabel('Conductance', 'nS')
ax1.set_xlim(-20, 20)
ax1.set_ylim(-1.5, 9.5)
ax1.set_xticks(np.arange(-20.0, 21.0, 10.0))
@@ -41,8 +41,8 @@ if __name__ == "__main__":
bw = 0.25
h, b = np.histogram(y-boltzmann(x, x0, k), np.arange(-3.0, 3.01, bw))
ax2.bar(b[:-1], h/np.sum(h)/(b[1]-b[0]), fc=colors['yellow'], width=bar_fac*bw, align='edge')
set_xlabel(ax2, 'Residuals', 'nS')
set_ylabel(ax2, 'Pdf', '1/nS')
ax2.set_xlabel('Residuals', 'nS')
ax2.set_ylabel('Pdf', '1/nS')
ax2.set_xlim(-2.5, 2.5)
ax2.set_ylim(0, 0.75)
ax2.set_yticks(np.arange(0, 0.75, 0.2))