[statistics] simplified plots, last part, added pointstyles

This commit is contained in:
2020-01-14 20:58:03 +01:00
parent 999a3003a6
commit 75aa46d71c
7 changed files with 53 additions and 23 deletions

View File

@@ -3,8 +3,8 @@ import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from plotstyle import *
fig = plt.figure(figsize=cm_size(figure_width, 1.5*figure_height))
spec = gridspec.GridSpec(nrows=2, ncols=2, wspace=0.35, hspace=0.35,
fig = plt.figure(figsize=cm_size(figure_width, 2.0*figure_height))
spec = gridspec.GridSpec(nrows=2, ncols=2, wspace=0.35, hspace=0.5,
**adjust_fs(fig, left=5.5, top=0.5, bottom=2.7))
rng = np.random.RandomState(2981)
n = 200
@@ -25,6 +25,6 @@ for k, r in enumerate([ 1.0, 0.6, 0.0, -0.9 ]) :
ax.set_ylabel('y')
ax.set_xlim(-3.0, 3.0)
ax.set_ylim(-3.0, 3.0)
ax.scatter(x[(np.abs(x)<2.8)&(np.abs(y)<2.8)], y[(np.abs(x)<2.8)&(np.abs(y)<2.8)])
ax.plot(x[(np.abs(x)<2.8)&(np.abs(y)<2.8)], y[(np.abs(x)<2.8)&(np.abs(y)<2.8)], **psAm)
plt.savefig('correlation.pdf')

View File

@@ -15,7 +15,7 @@ gauss = np.exp(-0.5*xx*xx)/np.sqrt(2.0*np.pi)
gausscdf = np.cumsum(gauss)*dx
# plot:
fig, ax = plt.subplots()
fig, ax = plt.subplots(figsize=cm_size(figure_width, 1.2*figure_height))
ax.set_xlabel('x')
ax.set_xlim(-3.2, 3.2)
ax.set_xticks(np.arange(-3.0, 3.1, 1.0))

View File

@@ -14,7 +14,7 @@ scatterpos = 1.0
barpos = 2.5
boxpos = 4.0
fig = plt.figure(figsize=cm_size(figure_width, 1.4*figure_height))
fig = plt.figure(figsize=cm_size(figure_width, 1.2*figure_height))
spec = gridspec.GridSpec(nrows=1, ncols=2, width_ratios=[3, 1], wspace=0.1,
**adjust_fs(fig, left=4.0))
@@ -61,7 +61,7 @@ ax.set_ylim( 0.0, 8.0)
kernel = gaussian_kde(data)
x = kernel(data)
x /= np.max(x)
ax.scatter(scatterpos+barwidth*x*(rng.rand(len(data))-0.5), data, s=50)
ax.plot(scatterpos+barwidth*x*(rng.rand(len(data))-0.5), data, **psA)
barmean = np.mean(data)
barstd = np.std(data)

View File

@@ -4,6 +4,8 @@ import matplotlib.gridspec as gridspec
from plotstyle import *
fig, (ax1, ax2) = plt.subplots(1, 2)
fig.subplots_adjust(wspace=0.35, hspace=0.5,
**adjust_fs(fig, left=4, top=0.5, bottom=2.7))
n = 200
rng = np.random.RandomState(3981)
@@ -18,7 +20,7 @@ ax1.set_xlabel('x')
ax1.set_ylabel('y')
ax1.set_xlim(-3.0, 3.0)
ax1.set_ylim(-0.5, 6.0)
ax1.scatter(x, z)
ax1.plot(x, z, **psAm)
z = 0.5*x*y
r =np.corrcoef(x,z)[0,1]
@@ -28,6 +30,6 @@ ax2.set_xlabel('x')
ax2.set_ylabel('y')
ax2.set_xlim(-3.0, 3.0)
ax2.set_ylim(-3.0, 3.0)
ax2.scatter(x, z)
ax2.plot(x, z, **psAm)
plt.savefig('nonlincorrelation.pdf')

View File

@@ -8,7 +8,7 @@ g = np.exp(-0.5*x*x)/np.sqrt(2.0*np.pi)
x1=0.0
x2=1.0
fig, ax = plt.subplots()
fig, ax = plt.subplots(figsize=cm_size(figure_width, 1.2*figure_height))
ax.set_xlabel('x')
ax.set_ylabel('Probability density p(x)')
ax.set_ylim(0.0, 0.46)

View File

@@ -7,7 +7,7 @@ x = np.arange( -4.0, 4.0, 0.01 )
g = np.exp(-0.5*x*x)/np.sqrt(2.0*np.pi)
q = [ -0.67488, 0.0, 0.67488 ]
fig, ax = plt.subplots(figsize=cm_size(figure_width, 1.2*figure_height))
fig, ax = plt.subplots(figsize=cm_size(figure_width, 1.0*figure_height))
fig.subplots_adjust(**adjust_fs(bottom=2.7, top=0.1))
ax.set_xlabel('x')
ax.set_ylabel('Probability density p(x)')