[all data analysis] plots work for old and new matplotlib

This commit is contained in:
2020-10-27 23:59:14 +01:00
parent d1c6174ae2
commit 2a4c7ff038
13 changed files with 145 additions and 270 deletions

View File

@@ -26,7 +26,7 @@ ax.set_ylim(-0.02, 0.85)
ax.set_xticks(np.arange(0, 5))
ax.set_yticks(np.arange(0, 0.9, 0.2))
ax.set_xlabel('x')
ax.set_ylabel('Probability density')
ax.set_ylabel('Prob. density')
s = 1
for mu in mus :
r = 5.0*rng.rand()+2.0
@@ -35,11 +35,11 @@ for mu in mus :
ax.annotate('', xy=(mu, 0.02), xycoords='data',
xytext=(mu, 0.75), textcoords='data',
arrowprops=dict(arrowstyle="->", relpos=(0.5,0.5),
connectionstyle=cs), zorder=1)
connectionstyle=cs), zorder=10)
if mu > rmu :
ax.text(mu-0.1, 0.04, '?', zorder=1, ha='right')
ax.text(mu-0.1, 0.04, '?', zorder=10, ha='right')
else :
ax.text(mu+0.1, 0.04, '?', zorder=1)
ax.text(mu+0.1, 0.04, '?', zorder=10)
for k, ls in enumerate([lsCm, lsBm, lsDm]) :
ax.plot(x, g[:,k], zorder=5, **ls)
ax.plot(xd, 0.05*rng.rand(len(xd))+0.2, zorder=10, **psAm)

View File

@@ -29,7 +29,7 @@ ax1.set_ylim(0.0, 0.42)
ax1.set_xticks(np.arange(0, 11, 2))
ax1.set_yticks(np.arange(0, 0.42, 0.1))
ax1.set_xlabel('x')
ax1.set_ylabel('Probability density')
ax1.set_ylabel('Prob. density')
ax1.plot(xx, yy, label='pdf', **lsB)
ax1.plot(xx, yf, label='mle', **lsCm)
kernel = st.gaussian_kde(xd)
@@ -54,7 +54,7 @@ ax2.set_xticks(np.arange(0, 11, 2))
ax2.set_xlabel('x')
ax2.set_ylim(0.0, 0.42)
ax2.set_yticks(np.arange(0, 0.42, 0.1))
ax2.set_ylabel('Probability density')
ax2.set_ylabel('Prob. density')
ax2.plot(xx, yy, label='pdf', **lsB)
ax2.plot(xx, yc, label='fit', **lsCm)
ax2.bar(b[:-1], h, np.diff(b), **fsA)

View File

@@ -6,7 +6,7 @@ from plotstyle import *
fig = plt.figure()
spec = gridspec.GridSpec(nrows=1, ncols=2, wspace=0.3,
**adjust_fs(fig, left=5.5))
**adjust_fs(fig, left=5.5, top=1))
spec1 = gridspec.GridSpecFromSubplotSpec(1, 2, spec[0, 0], width_ratios=[3, 1], wspace=0.0)
spec2 = gridspec.GridSpecFromSubplotSpec(1, 2, spec[0, 1], width_ratios=[3, 1], wspace=0.0)
@@ -34,7 +34,7 @@ ax.set_ylabel('y')
ax.plot(x, y, label='data', zorder=10, **psAm)
ax.plot(xx, yy, label='original', zorder=5, **lsB)
ax.plot(xx, yf, label='fit', zorder=7, **lsCm)
ax.legend(loc='upper left', bbox_to_anchor=(0.0, 1.15))
ax.legend(loc='upper left', bbox_to_anchor=(-0.05, 1.2))
ax = fig.add_subplot(spec1[0, 1])
ax.show_spines('l')