This commit is contained in:
Jan Grewe 2020-10-28 09:09:06 +01:00
commit e7679d72d8
18 changed files with 211 additions and 310 deletions

View File

@ -38,7 +38,7 @@ ax.annotate('sampling\ndistribution',
connectionstyle="angle3,angleA=20,angleB=120") ) connectionstyle="angle3,angleA=20,angleB=120") )
ax.annotate('bootstrap\ndistribution', ax.annotate('bootstrap\ndistribution',
xy=(0.13, 3.3), xycoords='data', xy=(0.13, 3.3), xycoords='data',
xytext=(0.25, 4), textcoords='data', xytext=(0.22, 4), textcoords='data',
arrowprops=dict(arrowstyle="->", relpos=(0.0,0.5), arrowprops=dict(arrowstyle="->", relpos=(0.0,0.5),
connectionstyle="angle3,angleA=20,angleB=60") ) connectionstyle="angle3,angleA=20,angleB=60") )
ax.bar(bins[:-1]-0.25*db, hmusrs, 0.5*db, **fsB) ax.bar(bins[:-1]-0.25*db, hmusrs, 0.5*db, **fsB)

View File

@ -44,19 +44,19 @@ ax.annotate('Measured\ncorrelation\nis significant!',
connectionstyle="angle3,angleA=10,angleB=80") ) connectionstyle="angle3,angleA=10,angleB=80") )
ax.annotate('95% percentile', ax.annotate('95% percentile',
xy=(0.14, 0.9), xycoords='data', xy=(0.14, 0.9), xycoords='data',
xytext=(0.2, 4.0), textcoords='data', ha='left', xytext=(0.18, 4.0), textcoords='data', ha='left',
arrowprops=dict(arrowstyle="->", relpos=(0.1,0.0), arrowprops=dict(arrowstyle="->", relpos=(0.1,0.0),
connectionstyle="angle3,angleA=30,angleB=70") ) connectionstyle="angle3,angleA=30,angleB=80") )
ax.annotate('Distribution of\nuncorrelated\nsamples', ax.annotate('Distribution of\nuncorrelated\nsamples',
xy=(-0.08, 3.6), xycoords='data', xy=(-0.08, 3.6), xycoords='data',
xytext=(-0.22, 5.0), textcoords='data', ha='left', xytext=(-0.22, 5.0), textcoords='data', ha='left',
arrowprops=dict(arrowstyle="->", relpos=(0.5,0.0), arrowprops=dict(arrowstyle="->", relpos=(0.5,0.0),
connectionstyle="angle3,angleA=150,angleB=100") ) connectionstyle="angle3,angleA=150,angleB=110") )
ax.bar(b[:-1], h, width=b[1]-b[0], **fsC) ax.bar(b[:-1], h, width=b[1]-b[0], **fsC)
ax.bar(b[:-1][b[:-1]>=rq], h[b[:-1]>=rq], width=b[1]-b[0], **fsB) ax.bar(b[:-1][b[:-1]>=rq], h[b[:-1]>=rq], width=b[1]-b[0], **fsB)
ax.plot( [rd, rd], [0, 1], **lsA) ax.plot( [rd, rd], [0, 1], **lsA)
ax.set_xlim(-0.25, 0.35) ax.set_xlim(-0.25, 0.35)
ax.set_xlabel('Correlation coefficient') ax.set_xlabel('Correlation coefficient')
ax.set_ylabel('Probability density of H0') ax.set_ylabel('Prob. density of H0')
plt.savefig('permutecorrelation.pdf') plt.savefig('permutecorrelation.pdf')

View File

@ -26,7 +26,7 @@ ax.set_ylim(-0.02, 0.85)
ax.set_xticks(np.arange(0, 5)) ax.set_xticks(np.arange(0, 5))
ax.set_yticks(np.arange(0, 0.9, 0.2)) ax.set_yticks(np.arange(0, 0.9, 0.2))
ax.set_xlabel('x') ax.set_xlabel('x')
ax.set_ylabel('Probability density') ax.set_ylabel('Prob. density')
s = 1 s = 1
for mu in mus : for mu in mus :
r = 5.0*rng.rand()+2.0 r = 5.0*rng.rand()+2.0
@ -35,11 +35,11 @@ for mu in mus :
ax.annotate('', xy=(mu, 0.02), xycoords='data', ax.annotate('', xy=(mu, 0.02), xycoords='data',
xytext=(mu, 0.75), textcoords='data', xytext=(mu, 0.75), textcoords='data',
arrowprops=dict(arrowstyle="->", relpos=(0.5,0.5), arrowprops=dict(arrowstyle="->", relpos=(0.5,0.5),
connectionstyle=cs), zorder=1) connectionstyle=cs), zorder=10)
if mu > rmu : 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 : 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]) : for k, ls in enumerate([lsCm, lsBm, lsDm]) :
ax.plot(x, g[:,k], zorder=5, **ls) ax.plot(x, g[:,k], zorder=5, **ls)
ax.plot(xd, 0.05*rng.rand(len(xd))+0.2, zorder=10, **psAm) 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_xticks(np.arange(0, 11, 2))
ax1.set_yticks(np.arange(0, 0.42, 0.1)) ax1.set_yticks(np.arange(0, 0.42, 0.1))
ax1.set_xlabel('x') ax1.set_xlabel('x')
ax1.set_ylabel('Probability density') ax1.set_ylabel('Prob. density')
ax1.plot(xx, yy, label='pdf', **lsB) ax1.plot(xx, yy, label='pdf', **lsB)
ax1.plot(xx, yf, label='mle', **lsCm) ax1.plot(xx, yf, label='mle', **lsCm)
kernel = st.gaussian_kde(xd) kernel = st.gaussian_kde(xd)
@ -54,7 +54,7 @@ ax2.set_xticks(np.arange(0, 11, 2))
ax2.set_xlabel('x') ax2.set_xlabel('x')
ax2.set_ylim(0.0, 0.42) ax2.set_ylim(0.0, 0.42)
ax2.set_yticks(np.arange(0, 0.42, 0.1)) 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, yy, label='pdf', **lsB)
ax2.plot(xx, yc, label='fit', **lsCm) ax2.plot(xx, yc, label='fit', **lsCm)
ax2.bar(b[:-1], h, np.diff(b), **fsA) ax2.bar(b[:-1], h, np.diff(b), **fsA)

View File

@ -6,7 +6,7 @@ from plotstyle import *
fig = plt.figure() fig = plt.figure()
spec = gridspec.GridSpec(nrows=1, ncols=2, wspace=0.3, 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) 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) 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(x, y, label='data', zorder=10, **psAm)
ax.plot(xx, yy, label='original', zorder=5, **lsB) ax.plot(xx, yy, label='original', zorder=5, **lsB)
ax.plot(xx, yf, label='fit', zorder=7, **lsCm) 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 = fig.add_subplot(spec1[0, 1])
ax.show_spines('l') ax.show_spines('l')

View File

@ -2,7 +2,11 @@ import matplotlib as mpl
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D from mpl_toolkits.mplot3d import Axes3D
xkcd_style = False # Set to true if you want xkcd-type sketchy plots:
xkcd_style = True
# matplotlib major version:
mpl_major = int(mpl.__version__.split('.')[0])
# default size of figure: # default size of figure:
figure_width = 15.0 # cm, should be set according to \textwidth in the latex document figure_width = 15.0 # cm, should be set according to \textwidth in the latex document
@ -26,7 +30,7 @@ colors['white'] = '#FFFFFF'
#colors_bendalab_vivid['green'] = '#30D700' #colors_bendalab_vivid['green'] = '#30D700'
#colors_bendalab_vivid['blue'] = '#0020C0' #colors_bendalab_vivid['blue'] = '#0020C0'
# line styles for plot(): # general settings for plot styles:
lwthick = 3.0 lwthick = 3.0
lwthin = 1.8 lwthin = 1.8
mainline = {'linestyle': '-', 'linewidth': lwthick} mainline = {'linestyle': '-', 'linewidth': lwthick}
@ -35,9 +39,12 @@ largemarker = {'marker': 'o', 'markersize': 9, 'markeredgecolor': colors['white'
smallmarker = {'marker': 'o', 'markersize': 6, 'markeredgecolor': colors['white'], 'markeredgewidth': 1} smallmarker = {'marker': 'o', 'markersize': 6, 'markeredgecolor': colors['white'], 'markeredgewidth': 1}
largelinepoints = {'linestyle': '-', 'linewidth': lwthick, 'marker': 'o', 'markersize': 10, 'markeredgecolor': colors['white'], 'markeredgewidth': 1} largelinepoints = {'linestyle': '-', 'linewidth': lwthick, 'marker': 'o', 'markersize': 10, 'markeredgecolor': colors['white'], 'markeredgewidth': 1}
smalllinepoints = {'linestyle': '-', 'linewidth': 1.4, 'marker': 'o', 'markersize': 7, 'markeredgecolor': colors['white'], 'markeredgewidth': 1} smalllinepoints = {'linestyle': '-', 'linewidth': 1.4, 'marker': 'o', 'markersize': 7, 'markeredgecolor': colors['white'], 'markeredgewidth': 1}
filllw = 1 filllw = 1.0
fillec = colors['white'] fillec = colors['white']
fillalpha = 0.4 fillalpha = 0.4
filledge = {'linewidth': filllw, 'joinstyle': 'round'}
if int(mpl.__version__.split('.')[0]) < 2:
del filledge['joinstyle']
# helper lines: # helper lines:
lsSpine = {'c': colors['black'], 'linestyle': '-', 'linewidth': 1, 'clip_on': False} lsSpine = {'c': colors['black'], 'linestyle': '-', 'linewidth': 1, 'clip_on': False}
@ -71,7 +78,7 @@ psA = dict({'color': colors['blue'], 'linestyle': 'none'}, **largemarker)
psAm = dict({'color': colors['blue'], 'linestyle': 'none'}, **smallmarker) psAm = dict({'color': colors['blue'], 'linestyle': 'none'}, **smallmarker)
lpsA = dict({'color': colors['blue']}, **largelinepoints) lpsA = dict({'color': colors['blue']}, **largelinepoints)
lpsAm = dict({'color': colors['blue']}, **smalllinepoints) lpsAm = dict({'color': colors['blue']}, **smalllinepoints)
fsA = {'facecolor': colors['blue'], 'edgecolor': fillec, 'linewidth': filllw} fsA = dict({'facecolor': colors['blue'], 'edgecolor': fillec}, **filledge)
fsAs = {'facecolor': colors['blue'], 'edgecolor': 'none'} fsAs = {'facecolor': colors['blue'], 'edgecolor': 'none'}
fsAa = {'facecolor': colors['blue'], 'edgecolor': 'none', 'alpha': fillalpha} fsAa = {'facecolor': colors['blue'], 'edgecolor': 'none', 'alpha': fillalpha}
@ -81,7 +88,7 @@ psB = dict({'color': colors['red'], 'linestyle': 'none'}, **largemarker)
psBm = dict({'color': colors['red'], 'linestyle': 'none'}, **smallmarker) psBm = dict({'color': colors['red'], 'linestyle': 'none'}, **smallmarker)
lpsB = dict({'color': colors['red']}, **largelinepoints) lpsB = dict({'color': colors['red']}, **largelinepoints)
lpsBm = dict({'color': colors['red']}, **smalllinepoints) lpsBm = dict({'color': colors['red']}, **smalllinepoints)
fsB = {'facecolor': colors['red'], 'edgecolor': fillec, 'linewidth': filllw} fsB = dict({'facecolor': colors['red'], 'edgecolor': fillec}, **filledge)
fsBs = {'facecolor': colors['red'], 'edgecolor': 'none'} fsBs = {'facecolor': colors['red'], 'edgecolor': 'none'}
fsBa = {'facecolor': colors['red'], 'edgecolor': 'none', 'alpha': fillalpha} fsBa = {'facecolor': colors['red'], 'edgecolor': 'none', 'alpha': fillalpha}
@ -89,7 +96,7 @@ lsC = dict({'color': colors['lightorange']}, **mainline)
lsCm = dict({'color': colors['lightorange']}, **minorline) lsCm = dict({'color': colors['lightorange']}, **minorline)
psC = dict({'color': colors['lightorange'], 'linestyle': 'none'}, **largemarker) psC = dict({'color': colors['lightorange'], 'linestyle': 'none'}, **largemarker)
psCm = dict({'color': colors['lightorange'], 'linestyle': 'none'}, **smallmarker) psCm = dict({'color': colors['lightorange'], 'linestyle': 'none'}, **smallmarker)
fsC = {'facecolor': colors['lightorange'], 'edgecolor': fillec, 'linewidth': filllw} fsC = dict({'facecolor': colors['lightorange'], 'edgecolor': fillec}, **filledge)
fsCs = {'facecolor': colors['lightorange'], 'edgecolor': 'none'} fsCs = {'facecolor': colors['lightorange'], 'edgecolor': 'none'}
fsCa = {'facecolor': colors['lightorange'], 'edgecolor': 'none', 'alpha': fillalpha} fsCa = {'facecolor': colors['lightorange'], 'edgecolor': 'none', 'alpha': fillalpha}
@ -97,17 +104,17 @@ lsD = dict({'color': colors['orange']}, **mainline)
lsDm = dict({'color': colors['orange']}, **minorline) lsDm = dict({'color': colors['orange']}, **minorline)
psD = dict({'color': colors['orange'], 'linestyle': 'none'}, **largemarker) psD = dict({'color': colors['orange'], 'linestyle': 'none'}, **largemarker)
psDm = dict({'color': colors['orange'], 'linestyle': 'none'}, **smallmarker) psDm = dict({'color': colors['orange'], 'linestyle': 'none'}, **smallmarker)
fsD = {'facecolor': colors['orange'], 'edgecolor': fillec, 'linewidth': filllw} fsD = dict({'facecolor': colors['orange'], 'edgecolor': fillec}, **filledge)
fsDs = {'facecolor': colors['orange'], 'edgecolor': 'none'} fsDs = {'facecolor': colors['orange'], 'edgecolor': 'none'}
lsE = dict({'color': colors['yellow']}, **mainline) lsE = dict({'color': colors['yellow']}, **mainline)
lsEm = dict({'color': colors['yellow']}, **minorline) lsEm = dict({'color': colors['yellow']}, **minorline)
psE = dict({'color': colors['yellow'], 'linestyle': 'none'}, **largemarker) psE = dict({'color': colors['yellow'], 'linestyle': 'none'}, **largemarker)
psEm = dict({'color': colors['yellow'], 'linestyle': 'none'}, **smallmarker) psEm = dict({'color': colors['yellow'], 'linestyle': 'none'}, **smallmarker)
fsE = {'facecolor': colors['yellow'], 'edgecolor': fillec, 'linewidth': filllw} fsE = dict({'facecolor': colors['yellow'], 'edgecolor': fillec}, **filledge)
fsEs = {'facecolor': colors['yellow'], 'edgecolor': 'none'} fsEs = {'facecolor': colors['yellow'], 'edgecolor': 'none'}
fsF = {'facecolor': colors['green'], 'edgecolor': fillec, 'linewidth': filllw} fsF = dict({'facecolor': colors['green'], 'edgecolor': fillec}, **filledge)
fsFs = {'facecolor': colors['green'], 'edgecolor': 'none'} fsFs = {'facecolor': colors['green'], 'edgecolor': 'none'}
# factor for scaling widths of bars in a bar plot: # factor for scaling widths of bars in a bar plot:
@ -270,7 +277,7 @@ def axis_label(label, unit=None):
if not unit: if not unit:
return label return label
elif xkcd_style: elif xkcd_style:
return '%s / %s' % (label, unit) return '%s/%s' % (label, unit)
else: else:
return '%s [%s]' % (label, unit) return '%s [%s]' % (label, unit)
@ -326,7 +333,7 @@ def set_zlabel(ax, label, unit=None, **kwargs):
ax.set_zlabel_orig(axis_label(label, unit), **kwargs) ax.set_zlabel_orig(axis_label(label, unit), **kwargs)
def common_format(): def common_style():
""" Set some rc parameter. """ Set some rc parameter.
""" """
mpl.rcParams['figure.figsize'] = cm_size(figure_width, figure_height) mpl.rcParams['figure.figsize'] = cm_size(figure_width, figure_height)
@ -337,6 +344,8 @@ def common_format():
mpl.rcParams['figure.subplot.wspace'] = 0.4 mpl.rcParams['figure.subplot.wspace'] = 0.4
mpl.rcParams['figure.subplot.hspace'] = 0.6 mpl.rcParams['figure.subplot.hspace'] = 0.6
mpl.rcParams['figure.facecolor'] = 'white' mpl.rcParams['figure.facecolor'] = 'white'
mpl.rcParams['figure.edgecolor'] = 'none'
mpl.rcParams['figure.frameon'] = False
mpl.rcParams['xtick.direction'] = 'out' mpl.rcParams['xtick.direction'] = 'out'
mpl.rcParams['ytick.direction'] = 'out' mpl.rcParams['ytick.direction'] = 'out'
mpl.rcParams['xtick.major.width'] = 1.25 mpl.rcParams['xtick.major.width'] = 1.25
@ -380,7 +389,7 @@ def sketch_style():
global bar_fac global bar_fac
bar_fac = 0.9 bar_fac = 0.9
plt.xkcd() plt.xkcd()
common_format() common_style()
mpl.rcParams['legend.fontsize'] = 'medium' mpl.rcParams['legend.fontsize'] = 'medium'
mpl.rcParams['xtick.labelsize'] = 'medium' mpl.rcParams['xtick.labelsize'] = 'medium'
mpl.rcParams['ytick.labelsize'] = 'medium' mpl.rcParams['ytick.labelsize'] = 'medium'
@ -394,7 +403,7 @@ def plain_style():
global bar_fac global bar_fac
bar_fac = 1.0 bar_fac = 1.0
plt.rcdefaults() plt.rcdefaults()
common_format() common_style()
mpl.rcParams['font.family'] = 'sans-serif' mpl.rcParams['font.family'] = 'sans-serif'
mpl.rcParams['legend.fontsize'] = 'x-small' mpl.rcParams['legend.fontsize'] = 'x-small'
mpl.rcParams['xtick.labelsize'] = 'small' mpl.rcParams['xtick.labelsize'] = 'small'

View File

@ -149,7 +149,7 @@ def plot_comparison(spike_times, bin_width, sigma, max_t=30., dt=1e-4):
ax1.show_spines('b') ax1.show_spines('b')
ax1.vlines(times[times < (100000*dt)], ymin=0, ymax=1, color=colors['blue'], lw=1.5) ax1.vlines(times[times < (100000*dt)], ymin=0, ymax=1, color=colors['blue'], lw=1.5)
#ax1.set_ylabel('Spikes') #ax1.set_ylabel('Spikes')
ax1.text(-0.105, 0.5, 'Spikes', transform=ax1.transAxes, ax1.text(-0.13, 0.5, 'Spikes', transform=ax1.transAxes,
rotation='vertical', va='center') rotation='vertical', va='center')
ax1.set_xlim(2.5, 3.5) ax1.set_xlim(2.5, 3.5)
ax1.set_ylim(-0.2, 1) ax1.set_ylim(-0.2, 1)
@ -159,7 +159,7 @@ def plot_comparison(spike_times, bin_width, sigma, max_t=30., dt=1e-4):
ax2.plot(time, inst_rate, color=colors['orange'], lw=2) ax2.plot(time, inst_rate, color=colors['orange'], lw=2)
ax2.text(1.0, 1.0, 'instantaneous rate', transform=ax2.transAxes, ha='right') ax2.text(1.0, 1.0, 'instantaneous rate', transform=ax2.transAxes, ha='right')
#ax2.set_ylabel('Rate', 'Hz') #ax2.set_ylabel('Rate', 'Hz')
ax2.text(-0.105, 0.5, axis_label('Rate', 'Hz'), transform=ax2.transAxes, ax2.text(-0.13, 0.5, axis_label('Rate', 'Hz'), transform=ax2.transAxes,
rotation='vertical', va='center') rotation='vertical', va='center')
ax2.set_xlim(2.5, 3.5) ax2.set_xlim(2.5, 3.5)
ax2.set_ylim(0, 300) ax2.set_ylim(0, 300)
@ -170,7 +170,7 @@ def plot_comparison(spike_times, bin_width, sigma, max_t=30., dt=1e-4):
ax3.plot(time, binn_rate, color=colors['orange'], lw=2) ax3.plot(time, binn_rate, color=colors['orange'], lw=2)
ax3.text(1.0, 1.0, 'binned rate', transform=ax3.transAxes, ha='right') ax3.text(1.0, 1.0, 'binned rate', transform=ax3.transAxes, ha='right')
#ax3.set_ylabel('Rate', 'Hz') #ax3.set_ylabel('Rate', 'Hz')
ax3.text(-0.105, 0.5, axis_label('Rate', 'Hz'), transform=ax3.transAxes, ax3.text(-0.13, 0.5, axis_label('Rate', 'Hz'), transform=ax3.transAxes,
rotation='vertical', va='center') rotation='vertical', va='center')
ax3.set_xlim(2.5, 3.5) ax3.set_xlim(2.5, 3.5)
ax3.set_ylim(0, 300) ax3.set_ylim(0, 300)
@ -182,7 +182,7 @@ def plot_comparison(spike_times, bin_width, sigma, max_t=30., dt=1e-4):
ax4.text(1.0, 1.0, 'convolved rate', transform=ax4.transAxes, ha='right') ax4.text(1.0, 1.0, 'convolved rate', transform=ax4.transAxes, ha='right')
ax4.set_xlabel('Time', 's') ax4.set_xlabel('Time', 's')
#ax4.set_ylabel('Rate', 'Hz') #ax4.set_ylabel('Rate', 'Hz')
ax4.text(-0.105, 0.5, axis_label('Rate', 'Hz'), transform=ax4.transAxes, ax4.text(-0.13, 0.5, axis_label('Rate', 'Hz'), transform=ax4.transAxes,
rotation='vertical', va='center') rotation='vertical', va='center')
ax4.set_xlim(2.5, 3.5) ax4.set_xlim(2.5, 3.5)
ax4.set_xticks([2.5, 2.75, 3.0, 3.25, 3.5]) ax4.set_xticks([2.5, 2.75, 3.0, 3.25, 3.5])

View File

@ -31,7 +31,7 @@ def setup_axis(spikes_ax, rate_ax):
spikes_ax.show_spines('') spikes_ax.show_spines('')
spikes_ax.set_yticks([]) spikes_ax.set_yticks([])
spikes_ax.set_ylim(-0.2, 1.0) spikes_ax.set_ylim(-0.2, 1.0)
spikes_ax.text(-0.1, 0.5, 'Spikes', transform=spikes_ax.transAxes, rotation='vertical', va='center') spikes_ax.text(-0.11, 0.5, 'Spikes', transform=spikes_ax.transAxes, rotation='vertical', va='center')
spikes_ax.set_xlim(-1, 500) spikes_ax.set_xlim(-1, 500)
spikes_ax.set_xticklabels([]) spikes_ax.set_xticklabels([])
#spikes_ax.set_xticklabels(np.arange(0., 600, 100)) #spikes_ax.set_xticklabels(np.arange(0., 600, 100))
@ -39,7 +39,7 @@ def setup_axis(spikes_ax, rate_ax):
spikes_ax.show_spines('lb') spikes_ax.show_spines('lb')
rate_ax.set_xlabel('Time', 'ms') rate_ax.set_xlabel('Time', 'ms')
#rate_ax.set_ylabel('Firing rate', 'Hz') #rate_ax.set_ylabel('Firing rate', 'Hz')
rate_ax.text(-0.1, 0.5, axis_label('Rate', 'Hz'), transform=rate_ax.transAxes, rate_ax.text(-0.11, 0.5, axis_label('Rate', 'Hz'), transform=rate_ax.transAxes,
rotation='vertical', va='center') rotation='vertical', va='center')
rate_ax.set_xlim(0, 500) rate_ax.set_xlim(0, 500)
#rate_ax.set_xticklabels(np.arange(0., 600, 100)) #rate_ax.set_xticklabels(np.arange(0., 600, 100))
@ -126,7 +126,7 @@ def plot_isi_method():
t_start = 1000*spike_times[i-1] t_start = 1000*spike_times[i-1]
t = 1000*spike_times[i] t = 1000*spike_times[i]
spikes_ax.plot([t_start, t_start], [0., 1.], color=colors['blue'], lw=2) spikes_ax.plot([t_start, t_start], [0., 1.], color=colors['blue'], lw=2)
spikes_ax.annotate(s='', xy=(t_start, 0.5), xytext=(t,0.5), arrowprops=dict(arrowstyle='<->'), color=colors['red']) spikes_ax.annotate('', xy=(t_start, 0.5), xytext=(t,0.5), arrowprops=dict(arrowstyle='<->'), color=colors['red'])
spikes_ax.text(0.5*(t_start+t), 1.05, spikes_ax.text(0.5*(t_start+t), 1.05,
"{0:.0f}".format((t - t_start)), "{0:.0f}".format((t - t_start)),
color=colors['red'], ha='center') color=colors['red'], ha='center')

View File

@ -1,7 +1,7 @@
%!PS-Adobe-2.0 EPSF-2.0 %!PS-Adobe-2.0 EPSF-2.0
%%Title: pointprocessscetchA.tex %%Title: pointprocessscetchA.tex
%%Creator: gnuplot 5.0 patchlevel 5 %%Creator: gnuplot 4.6 patchlevel 4
%%CreationDate: Tue Jan 7 10:05:37 2020 %%CreationDate: Tue Oct 27 23:58:04 2020
%%DocumentFonts: %%DocumentFonts:
%%BoundingBox: 50 50 373 135 %%BoundingBox: 50 50 373 135
%%EndComments %%EndComments
@ -18,7 +18,6 @@ gnudict begin
/Dashlength 1 def /Dashlength 1 def
/Landscape false def /Landscape false def
/Level1 false def /Level1 false def
/Level3 false def
/Rounded true def /Rounded true def
/ClipToBoundingBox false def /ClipToBoundingBox false def
/SuppressPDFMark false def /SuppressPDFMark false def
@ -30,11 +29,11 @@ gnudict begin
% %
/vshift -73 def /vshift -73 def
/dl1 { /dl1 {
10.0 Dashlength userlinewidth gnulinewidth div mul mul mul 10.0 Dashlength mul mul
Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if
} def } def
/dl2 { /dl2 {
10.0 Dashlength userlinewidth gnulinewidth div mul mul mul 10.0 Dashlength mul mul
Rounded { currentlinewidth 0.75 mul add } if Rounded { currentlinewidth 0.75 mul add } if
} def } def
/hpt_ 31.5 def /hpt_ 31.5 def
@ -48,7 +47,7 @@ gnudict begin
} if } if
} def } def
% %
% Gnuplot Prolog Version 5.1 (Oct 2015) % Gnuplot Prolog Version 4.6 (September 2012)
% %
%/SuppressPDFMark true def %/SuppressPDFMark true def
% %
@ -65,11 +64,11 @@ gnudict begin
/vpt2 vpt 2 mul def /vpt2 vpt 2 mul def
/hpt2 hpt 2 mul def /hpt2 hpt 2 mul def
/Lshow {currentpoint stroke M 0 vshift R /Lshow {currentpoint stroke M 0 vshift R
Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def Blacktext {gsave 0 setgray show grestore} {show} ifelse} def
/Rshow {currentpoint stroke M dup stringwidth pop neg vshift R /Rshow {currentpoint stroke M dup stringwidth pop neg vshift R
Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def Blacktext {gsave 0 setgray show grestore} {show} ifelse} def
/Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R /Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R
Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def Blacktext {gsave 0 setgray show grestore} {show} ifelse} def
/UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def /UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def
/hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def
/DL {Color {setrgbcolor Solid {pop []} if 0 setdash} /DL {Color {setrgbcolor Solid {pop []} if 0 setdash}
@ -83,7 +82,7 @@ gnudict begin
/PL {stroke userlinewidth setlinewidth /PL {stroke userlinewidth setlinewidth
Rounded {1 setlinejoin 1 setlinecap} if} def Rounded {1 setlinejoin 1 setlinecap} if} def
3.8 setmiterlimit 3.8 setmiterlimit
% Classic Line colors (version 5.0) % Default Line colors
/LCw {1 1 1} def /LCw {1 1 1} def
/LCb {0 0 0} def /LCb {0 0 0} def
/LCa {0 0 0} def /LCa {0 0 0} def
@ -96,21 +95,19 @@ gnudict begin
/LC6 {0 0 0} def /LC6 {0 0 0} def
/LC7 {1 0.3 0} def /LC7 {1 0.3 0} def
/LC8 {0.5 0.5 0.5} def /LC8 {0.5 0.5 0.5} def
% Default dash patterns (version 5.0) % Default Line Types
/LTB {BL [] LCb DL} def
/LTw {PL [] 1 setgray} def /LTw {PL [] 1 setgray} def
/LTb {PL [] LCb DL} def /LTb {BL [] LCb DL} def
/LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def /LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def
/LT0 {PL [] LC0 DL} def /LT0 {PL [] LC0 DL} def
/LT1 {PL [2 dl1 3 dl2] LC1 DL} def /LT1 {PL [4 dl1 2 dl2] LC1 DL} def
/LT2 {PL [1 dl1 1.5 dl2] LC2 DL} def /LT2 {PL [2 dl1 3 dl2] LC2 DL} def
/LT3 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC3 DL} def /LT3 {PL [1 dl1 1.5 dl2] LC3 DL} def
/LT4 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def /LT4 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def
/LT5 {PL [4 dl1 2 dl2] LC5 DL} def /LT5 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC5 DL} def
/LT6 {PL [1.5 dl1 1.5 dl2 1.5 dl1 1.5 dl2 1.5 dl1 6 dl2] LC6 DL} def /LT6 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC6 DL} def
/LT7 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC7 DL} def /LT7 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC7 DL} def
/LT8 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC8 DL} def /LT8 {PL [2 dl1 2 dl2 2 dl1 2 dl2 2 dl1 2 dl2 2 dl1 4 dl2] LC8 DL} def
/SL {[] 0 setdash} def
/Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def /Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def
/Dia {stroke [] 0 setdash 2 copy vpt add M /Dia {stroke [] 0 setdash 2 copy vpt add M
hpt neg vpt neg V hpt vpt neg V hpt neg vpt neg V hpt vpt neg V
@ -332,14 +329,9 @@ gnudict begin
% %
/languagelevel where /languagelevel where
{pop languagelevel} {1} ifelse {pop languagelevel} {1} ifelse
dup 2 lt 2 lt
{/InterpretLevel1 true def {/InterpretLevel1 true def}
/InterpretLevel3 false def} {/InterpretLevel1 Level1 def}
{/InterpretLevel1 Level1 def
2 gt
{/InterpretLevel3 Level3 def}
{/InterpretLevel3 false def}
ifelse }
ifelse ifelse
% %
% PostScript level 2 pattern fill definitions % PostScript level 2 pattern fill definitions
@ -428,7 +420,6 @@ Level1 {Level1PatternFill} {Level2PatternFill} ifelse
/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont /Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont
dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall
currentdict end definefont pop currentdict end definefont pop
%
Level1 SuppressPDFMark or Level1 SuppressPDFMark or
{} { {} {
/SDict 10 dict def /SDict 10 dict def
@ -438,42 +429,14 @@ systemdict /pdfmark known not {
SDict begin [ SDict begin [
/Title (pointprocessscetchA.tex) /Title (pointprocessscetchA.tex)
/Subject (gnuplot plot) /Subject (gnuplot plot)
/Creator (gnuplot 5.0 patchlevel 5) /Creator (gnuplot 4.6 patchlevel 4)
/Author (benda) /Author (jan)
% /Producer (gnuplot) % /Producer (gnuplot)
% /Keywords () % /Keywords ()
/CreationDate (Tue Jan 7 10:05:37 2020) /CreationDate (Tue Oct 27 23:58:04 2020)
/DOCINFO pdfmark /DOCINFO pdfmark
end end
} ifelse } ifelse
%
% Support for boxed text - Ethan A Merritt May 2005
%
/InitTextBox { userdict /TBy2 3 -1 roll put userdict /TBx2 3 -1 roll put
userdict /TBy1 3 -1 roll put userdict /TBx1 3 -1 roll put
/Boxing true def } def
/ExtendTextBox { Boxing
{ gsave dup false charpath pathbbox
dup TBy2 gt {userdict /TBy2 3 -1 roll put} {pop} ifelse
dup TBx2 gt {userdict /TBx2 3 -1 roll put} {pop} ifelse
dup TBy1 lt {userdict /TBy1 3 -1 roll put} {pop} ifelse
dup TBx1 lt {userdict /TBx1 3 -1 roll put} {pop} ifelse
grestore } if } def
/PopTextBox { newpath TBx1 TBxmargin sub TBy1 TBymargin sub M
TBx1 TBxmargin sub TBy2 TBymargin add L
TBx2 TBxmargin add TBy2 TBymargin add L
TBx2 TBxmargin add TBy1 TBymargin sub L closepath } def
/DrawTextBox { PopTextBox stroke /Boxing false def} def
/FillTextBox { gsave PopTextBox 1 1 1 setrgbcolor fill grestore /Boxing false def} def
0 0 0 0 InitTextBox
/TBxmargin 20 def
/TBymargin 20 def
/Boxing false def
/textshow { ExtendTextBox Gshow } def
%
% redundant definitions for compatibility with prologue.ps older than 5.0.2
/LTB {BL [] LCb DL} def
/LTb {PL [] LCb DL} def
end end
%%EndProlog %%EndProlog
%%Page: 1 1 %%Page: 1 1
@ -487,9 +450,10 @@ newpath
2.000 UL 2.000 UL
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 1.000 UP 0.00 0.00 0.00 C 1.000 UP
LTb
LCb setrgbcolor LCb setrgbcolor
LTb
1.000 UL 1.000 UL
LTb LTb
gsave 6208 824 N 0 -32 V 121 32 V -121 32 V 0 -32 V 1 PolyFill gsave 6208 824 N 0 -32 V 121 32 V -121 32 V 0 -32 V 1 PolyFill
@ -503,11 +467,9 @@ gsave 6208 824 N 0 -32 V 121 32 V -121 32 V 0 -32 V 1 PolyFill
stroke stroke
2.000 UL 2.000 UL
LTb LTb
0.00 0.00 0.00 C % Begin plot #1 0.00 0.00 0.00 C 10.000 UL
10.000 UL LT0
LTb LC0 setrgbcolor
LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 910 573 M 0.00 0.00 0.00 C 910 573 M
0 503 V 0 503 V
1412 573 M 1412 573 M
@ -526,16 +488,11 @@ LCb setrgbcolor
0 503 V 0 503 V
5685 573 M 5685 573 M
0 503 V 0 503 V
1.000 UP
stroke stroke
LTw
% End plot #1
2.000 UL 2.000 UL
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
1.000 UP
2.000 UL
LTb
0.00 0.00 0.00 C stroke 0.00 0.00 0.00 C stroke
grestore grestore
end end

View File

@ -1,7 +1,7 @@
%!PS-Adobe-2.0 EPSF-2.0 %!PS-Adobe-2.0 EPSF-2.0
%%Title: pointprocessscetchB.tex %%Title: pointprocessscetchB.tex
%%Creator: gnuplot 5.0 patchlevel 5 %%Creator: gnuplot 4.6 patchlevel 4
%%CreationDate: Tue Jan 7 10:05:38 2020 %%CreationDate: Tue Oct 27 23:58:04 2020
%%DocumentFonts: %%DocumentFonts:
%%BoundingBox: 50 50 373 237 %%BoundingBox: 50 50 373 237
%%EndComments %%EndComments
@ -18,7 +18,6 @@ gnudict begin
/Dashlength 1 def /Dashlength 1 def
/Landscape false def /Landscape false def
/Level1 false def /Level1 false def
/Level3 false def
/Rounded true def /Rounded true def
/ClipToBoundingBox false def /ClipToBoundingBox false def
/SuppressPDFMark false def /SuppressPDFMark false def
@ -30,11 +29,11 @@ gnudict begin
% %
/vshift -73 def /vshift -73 def
/dl1 { /dl1 {
10.0 Dashlength userlinewidth gnulinewidth div mul mul mul 10.0 Dashlength mul mul
Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if
} def } def
/dl2 { /dl2 {
10.0 Dashlength userlinewidth gnulinewidth div mul mul mul 10.0 Dashlength mul mul
Rounded { currentlinewidth 0.75 mul add } if Rounded { currentlinewidth 0.75 mul add } if
} def } def
/hpt_ 31.5 def /hpt_ 31.5 def
@ -48,7 +47,7 @@ gnudict begin
} if } if
} def } def
% %
% Gnuplot Prolog Version 5.1 (Oct 2015) % Gnuplot Prolog Version 4.6 (September 2012)
% %
%/SuppressPDFMark true def %/SuppressPDFMark true def
% %
@ -65,11 +64,11 @@ gnudict begin
/vpt2 vpt 2 mul def /vpt2 vpt 2 mul def
/hpt2 hpt 2 mul def /hpt2 hpt 2 mul def
/Lshow {currentpoint stroke M 0 vshift R /Lshow {currentpoint stroke M 0 vshift R
Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def Blacktext {gsave 0 setgray show grestore} {show} ifelse} def
/Rshow {currentpoint stroke M dup stringwidth pop neg vshift R /Rshow {currentpoint stroke M dup stringwidth pop neg vshift R
Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def Blacktext {gsave 0 setgray show grestore} {show} ifelse} def
/Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R /Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R
Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def Blacktext {gsave 0 setgray show grestore} {show} ifelse} def
/UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def /UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def
/hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def
/DL {Color {setrgbcolor Solid {pop []} if 0 setdash} /DL {Color {setrgbcolor Solid {pop []} if 0 setdash}
@ -83,7 +82,7 @@ gnudict begin
/PL {stroke userlinewidth setlinewidth /PL {stroke userlinewidth setlinewidth
Rounded {1 setlinejoin 1 setlinecap} if} def Rounded {1 setlinejoin 1 setlinecap} if} def
3.8 setmiterlimit 3.8 setmiterlimit
% Classic Line colors (version 5.0) % Default Line colors
/LCw {1 1 1} def /LCw {1 1 1} def
/LCb {0 0 0} def /LCb {0 0 0} def
/LCa {0 0 0} def /LCa {0 0 0} def
@ -96,21 +95,19 @@ gnudict begin
/LC6 {0 0 0} def /LC6 {0 0 0} def
/LC7 {1 0.3 0} def /LC7 {1 0.3 0} def
/LC8 {0.5 0.5 0.5} def /LC8 {0.5 0.5 0.5} def
% Default dash patterns (version 5.0) % Default Line Types
/LTB {BL [] LCb DL} def
/LTw {PL [] 1 setgray} def /LTw {PL [] 1 setgray} def
/LTb {PL [] LCb DL} def /LTb {BL [] LCb DL} def
/LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def /LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def
/LT0 {PL [] LC0 DL} def /LT0 {PL [] LC0 DL} def
/LT1 {PL [2 dl1 3 dl2] LC1 DL} def /LT1 {PL [4 dl1 2 dl2] LC1 DL} def
/LT2 {PL [1 dl1 1.5 dl2] LC2 DL} def /LT2 {PL [2 dl1 3 dl2] LC2 DL} def
/LT3 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC3 DL} def /LT3 {PL [1 dl1 1.5 dl2] LC3 DL} def
/LT4 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def /LT4 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def
/LT5 {PL [4 dl1 2 dl2] LC5 DL} def /LT5 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC5 DL} def
/LT6 {PL [1.5 dl1 1.5 dl2 1.5 dl1 1.5 dl2 1.5 dl1 6 dl2] LC6 DL} def /LT6 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC6 DL} def
/LT7 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC7 DL} def /LT7 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC7 DL} def
/LT8 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC8 DL} def /LT8 {PL [2 dl1 2 dl2 2 dl1 2 dl2 2 dl1 2 dl2 2 dl1 4 dl2] LC8 DL} def
/SL {[] 0 setdash} def
/Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def /Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def
/Dia {stroke [] 0 setdash 2 copy vpt add M /Dia {stroke [] 0 setdash 2 copy vpt add M
hpt neg vpt neg V hpt vpt neg V hpt neg vpt neg V hpt vpt neg V
@ -332,14 +329,9 @@ gnudict begin
% %
/languagelevel where /languagelevel where
{pop languagelevel} {1} ifelse {pop languagelevel} {1} ifelse
dup 2 lt 2 lt
{/InterpretLevel1 true def {/InterpretLevel1 true def}
/InterpretLevel3 false def} {/InterpretLevel1 Level1 def}
{/InterpretLevel1 Level1 def
2 gt
{/InterpretLevel3 Level3 def}
{/InterpretLevel3 false def}
ifelse }
ifelse ifelse
% %
% PostScript level 2 pattern fill definitions % PostScript level 2 pattern fill definitions
@ -428,7 +420,6 @@ Level1 {Level1PatternFill} {Level2PatternFill} ifelse
/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont /Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont
dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall
currentdict end definefont pop currentdict end definefont pop
%
Level1 SuppressPDFMark or Level1 SuppressPDFMark or
{} { {} {
/SDict 10 dict def /SDict 10 dict def
@ -438,42 +429,14 @@ systemdict /pdfmark known not {
SDict begin [ SDict begin [
/Title (pointprocessscetchB.tex) /Title (pointprocessscetchB.tex)
/Subject (gnuplot plot) /Subject (gnuplot plot)
/Creator (gnuplot 5.0 patchlevel 5) /Creator (gnuplot 4.6 patchlevel 4)
/Author (benda) /Author (jan)
% /Producer (gnuplot) % /Producer (gnuplot)
% /Keywords () % /Keywords ()
/CreationDate (Tue Jan 7 10:05:38 2020) /CreationDate (Tue Oct 27 23:58:04 2020)
/DOCINFO pdfmark /DOCINFO pdfmark
end end
} ifelse } ifelse
%
% Support for boxed text - Ethan A Merritt May 2005
%
/InitTextBox { userdict /TBy2 3 -1 roll put userdict /TBx2 3 -1 roll put
userdict /TBy1 3 -1 roll put userdict /TBx1 3 -1 roll put
/Boxing true def } def
/ExtendTextBox { Boxing
{ gsave dup false charpath pathbbox
dup TBy2 gt {userdict /TBy2 3 -1 roll put} {pop} ifelse
dup TBx2 gt {userdict /TBx2 3 -1 roll put} {pop} ifelse
dup TBy1 lt {userdict /TBy1 3 -1 roll put} {pop} ifelse
dup TBx1 lt {userdict /TBx1 3 -1 roll put} {pop} ifelse
grestore } if } def
/PopTextBox { newpath TBx1 TBxmargin sub TBy1 TBymargin sub M
TBx1 TBxmargin sub TBy2 TBymargin add L
TBx2 TBxmargin add TBy2 TBymargin add L
TBx2 TBxmargin add TBy1 TBymargin sub L closepath } def
/DrawTextBox { PopTextBox stroke /Boxing false def} def
/FillTextBox { gsave PopTextBox 1 1 1 setrgbcolor fill grestore /Boxing false def} def
0 0 0 0 InitTextBox
/TBxmargin 20 def
/TBymargin 20 def
/Boxing false def
/textshow { ExtendTextBox Gshow } def
%
% redundant definitions for compatibility with prologue.ps older than 5.0.2
/LTB {BL [] LCb DL} def
/LTb {PL [] LCb DL} def
end end
%%EndProlog %%EndProlog
%%Page: 1 1 %%Page: 1 1
@ -487,9 +450,10 @@ newpath
2.000 UL 2.000 UL
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 1.000 UP 0.00 0.00 0.00 C 1.000 UP
LTb
LCb setrgbcolor LCb setrgbcolor
LTb
1.000 UL 1.000 UL
LTb LTb
gsave 6208 3165 N 0 -32 V 121 32 V -121 32 V 0 -32 V 1 PolyFill gsave 6208 3165 N 0 -32 V 121 32 V -121 32 V 0 -32 V 1 PolyFill
@ -503,11 +467,9 @@ gsave 6208 3165 N 0 -32 V 121 32 V -121 32 V 0 -32 V 1 PolyFill
stroke stroke
2.000 UL 2.000 UL
LTb LTb
0.00 0.00 0.00 C % Begin plot #1 0.00 0.00 0.00 C 10.000 UL
10.000 UL LT0
LTb LC0 setrgbcolor
LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 910 3029 M 0.00 0.00 0.00 C 910 3029 M
0 272 V 0 272 V
502 -272 R 502 -272 R
@ -526,22 +488,18 @@ LCb setrgbcolor
0 272 V 0 272 V
5685 3029 M 5685 3029 M
0 272 V 0 272 V
1.000 UP
stroke stroke
LTw
% End plot #1
2.000 UL 2.000 UL
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
1.000 UP
2.000 UL
LTb
0.00 0.00 0.00 C 2.000 UL 0.00 0.00 0.00 C 2.000 UL
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 1.000 UP 0.00 0.00 0.00 C 1.000 UP
LTb
LCb setrgbcolor LCb setrgbcolor
LTb
1.000 UL 1.000 UL
LTb LTb
gsave 6208 2043 N 0 -32 V 121 32 V -121 32 V 0 -32 V 1 PolyFill gsave 6208 2043 N 0 -32 V 121 32 V -121 32 V 0 -32 V 1 PolyFill
@ -552,86 +510,76 @@ gsave 6208 2043 N 0 -32 V 121 32 V -121 32 V 0 -32 V 1 PolyFill
0 -32 V 0 -32 V
-5680 0 R -5680 0 R
5680 0 V 5680 0 V
stroke
1291 1929 M 1291 1929 M
121 32 V 121 32 V
-121 32 V -121 32 V
-260 0 R -260 -64 R
910 1961 L -121 32 V
121 -32 V 121 32 V
-121 32 R 910 1961 M
502 0 V 502 0 V
stroke 590 -32 R
2002 1929 M
121 32 V 121 32 V
-121 32 V -121 32 V
-469 0 R -469 -64 R
-121 -32 V -121 32 V
121 -32 V 121 32 V
-121 32 R -121 -32 R
711 0 V 711 0 V
stroke 206 -22 R
2329 1939 M
84 22 V 84 22 V
-84 22 V -84 22 V
-122 0 R -122 -44 R
-84 -22 V -84 22 V
84 -22 V 84 22 V
-84 22 R -84 -22 R
290 0 V 290 0 V
stroke 216 -23 R
2629 1938 M
88 23 V 88 23 V
-88 23 V -88 23 V
-128 0 R -128 -46 R
-88 -23 V -88 23 V
88 -23 V 88 23 V
-88 23 R -88 -23 R
304 0 V 304 0 V
stroke 329 -32 R
3046 1929 M
121 32 V 121 32 V
-121 32 V -121 32 V
-208 0 R -208 -64 R
-121 -32 V -121 32 V
121 -32 V 121 32 V
-121 32 R -121 -32 R
450 0 V 450 0 V
stroke 745 -32 R
3912 1929 M
121 32 V 121 32 V
-121 32 V -121 32 V
-624 0 R -624 -64 R
-121 -32 V -121 32 V
121 -32 V 121 32 V
-121 32 R -121 -32 R
866 0 V 866 0 V
stroke 496 -32 R
4529 1929 M
121 32 V 121 32 V
-121 32 V -121 32 V
-375 0 R -375 -64 R
-121 -32 V -121 32 V
121 -32 V 121 32 V
-121 32 R -121 -32 R
617 0 V 617 0 V
stroke 914 -32 R
5564 1929 M
121 32 V 121 32 V
-121 32 V -121 32 V
-793 0 R -793 -64 R
-121 -32 V -121 32 V
121 -32 V 121 32 V
-121 32 R -121 -32 R
1035 0 V 1035 0 V
stroke stroke
2.000 UL 2.000 UL
LTb LTb
0.00 0.00 0.00 C % Begin plot #1 0.00 0.00 0.00 C 10.000 UL
10.000 UL LT0
LTb LC0 setrgbcolor
LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 910 1907 M 0.00 0.00 0.00 C 910 1907 M
0 272 V 0 272 V
502 -272 R 502 -272 R
@ -650,60 +598,47 @@ LCb setrgbcolor
0 272 V 0 272 V
5685 1907 M 5685 1907 M
0 272 V 0 272 V
1.000 UP
stroke stroke
LTw
% End plot #1
2.000 UL 2.000 UL
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
1.000 UP
2.000 UL
LTb
0.00 0.00 0.00 C 2.000 UL 0.00 0.00 0.00 C 2.000 UL
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 528 268 M 0.00 0.00 0.00 C 528 268 M
-63 0 V -63 0 V
stroke stroke
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 528 460 M 0.00 0.00 0.00 C 528 460 M
-63 0 V -63 0 V
stroke stroke
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 528 652 M 0.00 0.00 0.00 C 528 652 M
-63 0 V -63 0 V
stroke stroke
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 528 844 M 0.00 0.00 0.00 C 528 844 M
-63 0 V -63 0 V
stroke stroke
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 528 1036 M 0.00 0.00 0.00 C 528 1036 M
-63 0 V -63 0 V
stroke stroke
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 528 1228 M 0.00 0.00 0.00 C 528 1228 M
-63 0 V -63 0 V
stroke stroke
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 2.000 UL 0.00 0.00 0.00 C 2.000 UL
LTb LTb
LCb setrgbcolor LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 528 1276 M 0.00 0.00 0.00 C 528 1276 M
528 220 L 528 220 L
5801 0 R 5801 0 R
@ -711,7 +646,9 @@ LCb setrgbcolor
-5801 0 R -5801 0 R
1.000 UP 1.000 UP
stroke stroke
LTb
LCb setrgbcolor LCb setrgbcolor
LTb
1.000 UL 1.000 UL
LTb LTb
gsave 6208 268 N 0 -32 V 121 32 V -121 32 V 0 -32 V 1 PolyFill gsave 6208 268 N 0 -32 V 121 32 V -121 32 V 0 -32 V 1 PolyFill
@ -725,11 +662,9 @@ gsave 6208 268 N 0 -32 V 121 32 V -121 32 V 0 -32 V 1 PolyFill
stroke stroke
2.000 UL 2.000 UL
LTb LTb
0.00 0.00 0.00 C % Begin plot #1 0.00 0.00 0.00 C 3.000 UL
3.000 UL LT0
LTb LC0 setrgbcolor
LCb setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 528 268 M 0.00 0.00 0.00 C 528 268 M
382 0 V 382 0 V
0 96 R 0 96 R
@ -750,15 +685,11 @@ LCb setrgbcolor
1035 0 V 1035 0 V
0 96 R 0 96 R
533 0 V 533 0 V
stroke
LTw
% End plot #1
% Begin plot #2
1.500 UP 1.500 UP
stroke
2.000 UL 2.000 UL
LTb LT0
LCb setrgbcolor LC0 setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 910 268 CircleF 0.00 0.00 0.00 C 910 268 CircleF
1412 364 CircleF 1412 364 CircleF
2123 460 CircleF 2123 460 CircleF
@ -768,14 +699,10 @@ LCb setrgbcolor
4033 844 CircleF 4033 844 CircleF
4650 940 CircleF 4650 940 CircleF
5685 1036 CircleF 5685 1036 CircleF
LTw
% End plot #2
% Begin plot #3
1.000 UP 1.000 UP
2.000 UL 2.000 UL
LTb LT0
LCb setrgbcolor LC0 setrgbcolor
[] 0 setdash
1.00 1.00 1.00 C 910 268 CircleF 1.00 1.00 1.00 C 910 268 CircleF
1412 364 CircleF 1412 364 CircleF
2123 460 CircleF 2123 460 CircleF
@ -785,14 +712,10 @@ LCb setrgbcolor
4033 844 CircleF 4033 844 CircleF
4650 940 CircleF 4650 940 CircleF
5685 1036 CircleF 5685 1036 CircleF
LTw
% End plot #3
% Begin plot #4
1.500 UP 1.500 UP
2.000 UL 2.000 UL
LTb LT0
LCb setrgbcolor LC0 setrgbcolor
[] 0 setdash
0.00 0.00 0.00 C 910 364 CircleF 0.00 0.00 0.00 C 910 364 CircleF
1412 460 CircleF 1412 460 CircleF
2123 556 CircleF 2123 556 CircleF
@ -802,15 +725,10 @@ LCb setrgbcolor
4033 940 CircleF 4033 940 CircleF
4650 1036 CircleF 4650 1036 CircleF
5685 1132 CircleF 5685 1132 CircleF
LTw
% End plot #4
2.000 UL
LTb
LCb setrgbcolor
[] 0 setdash
1.000 UP 1.000 UP
2.000 UL 2.000 UL
LTb LTb
LCb setrgbcolor
0.00 0.00 0.00 C stroke 0.00 0.00 0.00 C stroke
grestore grestore
end end

View File

@ -24,7 +24,7 @@ ax.set_xlabel('x')
ax.set_ylabel('y', rotation='horizontal') ax.set_ylabel('y', rotation='horizontal')
ax.set_xticks(np.arange(x1, x2+0.1, 1.0)) ax.set_xticks(np.arange(x1, x2+0.1, 1.0))
ax.set_yticks(np.arange(x1, x2+0.1, 1.0)) ax.set_yticks(np.arange(x1, x2+0.1, 1.0))
ax.contour(X, Y, Z, linewidths=2, zorder=0) ax.contour(X, Y, Z, linewidths=2, cmap='jet', zorder=0)
# gradients: # gradients:
xxg = [-1.1, 1.4, -1.0] xxg = [-1.1, 1.4, -1.0]
@ -35,8 +35,8 @@ for xg, yg in zip(xxg, yyg) :
ax.scatter(xg, yg, c='k', s=100, zorder=10) ax.scatter(xg, yg, c='k', s=100, zorder=10)
ax.quiver([xg, xg], [yg, yg], [g[0], 0.0], [0.0, g[1]], units='xy', angles='uv', scale_units='x', scale=0.5, zorder=10) ax.quiver([xg, xg], [yg, yg], [g[0], 0.0], [0.0, g[1]], units='xy', angles='uv', scale_units='x', scale=0.5, zorder=10)
ax.quiver([xg], [yg], [g[0]], [g[1]], units='xy', angles='uv', scale_units='x', scale=0.5, zorder=10, lw=2) ax.quiver([xg], [yg], [g[0]], [g[1]], units='xy', angles='uv', scale_units='x', scale=0.5, zorder=10, lw=2)
ax.text(-0.8, -1.5, '$\partial f/\partial x$', ha='center', zorder=20) ax.text(-0.8, -1.4, '$\partial f/\partial x$', ha='center', zorder=20)
ax.text(-1.55, -0.8, '$\partial f/\partial y$', va='center', rotation='vertical', zorder=20) ax.text(-1.45, -0.8, '$\partial f/\partial y$', va='center', rotation='vertical', zorder=20)
ax.text(-0.4, -0.8, r'$\nabla f$', ha='left', zorder=20) ax.text(-0.5, -0.8, r'$\nabla f$', ha='left', zorder=20)
plt.savefig('gradient.pdf') plt.savefig('gradient.pdf')

View File

@ -2,7 +2,6 @@ import numpy as np
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from plotstyle import * from plotstyle import *
sketch_style()
# roll the die: # roll the die:
rng = np.random.RandomState(57281) rng = np.random.RandomState(57281)
x1 = rng.randint(1, 7, 100) x1 = rng.randint(1, 7, 100)
@ -27,6 +26,9 @@ ax2.set_xlabel('x')
ax2.set_ylim(0, 0.23) ax2.set_ylim(0, 0.23)
ax2.set_ylabel('Probability') ax2.set_ylabel('Probability')
ax2.plot([0.2, 6.8], [1.0/6.0, 1.0/6.0], zorder=-10, **lsAm) ax2.plot([0.2, 6.8], [1.0/6.0, 1.0/6.0], zorder=-10, **lsAm)
ax2.hist([x2, x1], bins, density=True, zorder=-5, **fs) if mpl_major > 1:
ax2.hist([x2, x1], bins, density=True, zorder=-5, **fs)
else:
ax2.hist([x2, x1], bins, normed=True, zorder=-5, **fs)
fig.subplots_adjust(left=0.125) fig.subplots_adjust(left=0.125)
fig.savefig('diehistograms.pdf') fig.savefig('diehistograms.pdf')

View File

@ -4,7 +4,6 @@ import matplotlib.gridspec as gridspec
from scipy.stats import gaussian_kde from scipy.stats import gaussian_kde
from plotstyle import * from plotstyle import *
sketch_style()
#rng = np.random.RandomState(981) #rng = np.random.RandomState(981)
#data = rng.randn(40, 1) + 4.0 #data = rng.randn(40, 1) + 4.0
rng = np.random.RandomState(1981) rng = np.random.RandomState(1981)
@ -19,9 +18,11 @@ fig = plt.figure(figsize=cm_size(figure_width, 1.1*figure_height))
spec = gridspec.GridSpec(nrows=1, ncols=2, width_ratios=[3, 1], wspace=0.1, spec = gridspec.GridSpec(nrows=1, ncols=2, width_ratios=[3, 1], wspace=0.1,
**adjust_fs(fig, left=4.0)) **adjust_fs(fig, left=4.0))
ax = fig.add_subplot(spec[0, 0]) ax = fig.add_subplot(spec[0, 0], label='1')
wh = ax.boxplot( data, positions=[boxpos], widths=[barwidth], whis=100.0, patch_artist=True) wh = ax.boxplot( data, positions=[boxpos], widths=[barwidth], whis=100.0, patch_artist=True)
mediancolor = 'k'
wh['medians'][0].set_linewidth(4) wh['medians'][0].set_linewidth(4)
wh['medians'][0].set_color(mediancolor)
wh['whiskers'][0].set_linewidth(2) wh['whiskers'][0].set_linewidth(2)
wh['whiskers'][1].set_linewidth(2) wh['whiskers'][1].set_linewidth(2)
wh['whiskers'][0].set_linestyle('-') wh['whiskers'][0].set_linestyle('-')
@ -34,6 +35,16 @@ wh['caps'][1].set_color(whiskercolor)
wh['boxes'][0].set_facecolor('#99ff00') wh['boxes'][0].set_facecolor('#99ff00')
ax.set_xlim(0.0, 4.8) ax.set_xlim(0.0, 4.8)
ax.set_ylim( 0.0, 8.0) ax.set_ylim( 0.0, 8.0)
ax.set_xticklabels([])
ax = fig.add_subplot(spec[0, 0], label='2')
ax.set_xlim(0.0, 4.8)
ax.set_xticks([scatterpos, barpos, boxpos])
ax.set_xticklabels(['(1) data', '(2) bar\n plot', '(3) box-\nwhisker'], fontsize='medium')
ax.set_ylabel('x')
ax.set_ylim( 0.0, 8.0)
# annotate box whisker:
ax.annotate('maximum', ax.annotate('maximum',
xy=(boxpos, 6.5), xycoords='data', xy=(boxpos, 6.5), xycoords='data',
xytext=(boxpos-1*barwidth, 7.6), textcoords='data', ha='left', xytext=(boxpos-1*barwidth, 7.6), textcoords='data', ha='left',
@ -49,14 +60,6 @@ ax.annotate('median',
xytext=(boxpos+0.1*barwidth, 4.2), textcoords='data', ha='left', xytext=(boxpos+0.1*barwidth, 4.2), textcoords='data', ha='left',
arrowprops=dict(arrowstyle="->", relpos=(0.8,0.0), arrowprops=dict(arrowstyle="->", relpos=(0.8,0.0),
connectionstyle="angle3,angleA=-60,angleB=20") ) connectionstyle="angle3,angleA=-60,angleB=20") )
ax.set_xticklabels([])
ax = fig.add_subplot(spec[0, 0])
ax.set_xlim(0.0, 4.8)
ax.set_xticks([scatterpos, barpos, boxpos])
ax.set_xticklabels(['(1) data', '(2) bar\n plot', '(3) box-\nwhisker'], fontsize='medium')
ax.set_ylabel('x')
ax.set_ylim( 0.0, 8.0)
# scatter data points according to their density: # scatter data points according to their density:
kernel = gaussian_kde(data) kernel = gaussian_kde(data)
@ -67,7 +70,10 @@ ax.plot(scatterpos+barwidth*x*(rng.rand(len(data))-0.5), data, **psA)
barmean = np.mean(data) barmean = np.mean(data)
barstd = np.std(data) barstd = np.std(data)
ew = 0.2 ew = 0.2
ax.bar([barpos-0.5*barwidth], [barmean], barwidth, **fsC) if mpl_major > 1:
ax.bar([barpos], [barmean], barwidth, **fsC)
else:
ax.bar([barpos-0.5*barwidth], [barmean], barwidth, **fsC)
ax.plot([barpos, barpos], [barmean-barstd, barmean+barstd], **lsMarker) ax.plot([barpos, barpos], [barmean-barstd, barmean+barstd], **lsMarker)
ax.plot([barpos-0.5*ew, barpos+0.5*ew], [barmean-barstd, barmean-barstd], **lsMarker) ax.plot([barpos-0.5*ew, barpos+0.5*ew], [barmean-barstd, barmean-barstd], **lsMarker)
ax.plot([barpos-0.5*ew, barpos+0.5*ew], [barmean+barstd, barmean+barstd], **lsMarker) ax.plot([barpos-0.5*ew, barpos+0.5*ew], [barmean+barstd, barmean+barstd], **lsMarker)

View File

@ -1,6 +1,7 @@
import numpy as np import numpy as np
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec import matplotlib.gridspec as gridspec
import matplotlib.ticker as ticker
from plotstyle import * from plotstyle import *
# normal distribution: # normal distribution:
@ -37,35 +38,39 @@ spec = gridspec.GridSpec(nrows=2, ncols=2, wspace=0.35, hspace=0.3,
**adjust_fs(fig, left=5.5, top=0.2, bottom=2.7)) **adjust_fs(fig, left=5.5, top=0.2, bottom=2.7))
ax = fig.add_subplot(spec[0, 0]) ax = fig.add_subplot(spec[0, 0])
ax.set_xlabel('x')
ax.set_xlim(-3.2, 3.2) ax.set_xlim(-3.2, 3.2)
ax.set_xticks(np.arange(-3.0, 3.1, 1.0)) ax.xaxis.set_major_locator(ticker.MultipleLocator(1.0))
ax.xaxis.set_major_formatter(ticker.NullFormatter())
ax.set_ylabel('p(x)') ax.set_ylabel('p(x)')
ax.set_ylim(0.0, 0.49) ax.set_ylim(0.0, 0.49)
ax.set_yticks(np.arange(0.0, 0.41, 0.1)) ax.yaxis.set_major_locator(ticker.MultipleLocator(0.2))
#ax.plot(x, g, '-b', lw=2, zorder=-1) if mpl_major > 1:
ax.hist(r, np.arange(-4.1, 4, 0.4), density=True, zorder=-5, **fsC) ax.hist(r, np.arange(-4.1, 4, 0.4), density=True, zorder=-5, **fsC)
else:
ax.hist(r, np.arange(-4.1, 4, 0.4), normed=True, zorder=-5, **fsC)
ax = fig.add_subplot(spec[1, 0]) ax = fig.add_subplot(spec[1, 0])
ax.set_xlabel('x') ax.set_xlabel('x')
ax.set_xlim(-3.2, 3.2) ax.set_xlim(-3.2, 3.2)
ax.set_xticks(np.arange(-3.0, 3.1, 1.0)) ax.xaxis.set_major_locator(ticker.MultipleLocator(1.0))
ax.set_ylabel('p(x)') ax.set_ylabel('p(x)')
ax.set_ylim(0.0, 0.49) ax.set_ylim(0.0, 0.49)
ax.set_yticks(np.arange(0.0, 0.41, 0.1)) ax.yaxis.set_major_locator(ticker.MultipleLocator(0.2))
#ax.plot(x, g, '-b', lw=2, zorder=-1) if mpl_major > 1:
ax.hist(r, np.arange(-4.3, 4, 0.4), density=True, zorder=-5, **fsC) ax.hist(r, np.arange(-4.3, 4, 0.4), density=True, zorder=-5, **fsC)
else:
ax.hist(r, np.arange(-4.3, 4, 0.4), normed=True, zorder=-5, **fsC)
ax = fig.add_subplot(spec[:, 1]) ax = fig.add_subplot(spec[:, 1])
ax.set_xlabel('x') ax.set_xlabel('x')
ax.set_xlim(-3.2, 3.2) ax.set_xlim(-3.2, 3.2)
ax.set_xticks(np.arange(-3.0, 3.1, 1.0)) ax.xaxis.set_major_locator(ticker.MultipleLocator(1.0))
ax.set_ylabel('Prob. density p(x)') ax.set_ylabel('Prob. density p(x)')
ax.set_ylim(0.0, 0.49) ax.set_ylim(0.0, 0.49)
ax.set_yticks(np.arange(0.0, 0.41, 0.1)) ax.set_yticks(np.arange(0.0, 0.41, 0.1))
kd, xx = kerneldensity(r, -3.2, 3.2, 0.2) kd, xx = kerneldensity(r, -3.2, 3.2, 0.2)
ax.fill_between(xx, 0.0, kd, zorder=-5, **fsDs) ax.fill_between(xx, 0.0, kd, zorder=-5, **fsDs)
ax.plot(xx, kd, '-', zorder=-1, **lsB) ax.plot(xx, kd, '-', zorder=-1, **lsB)
fig.subplots_adjust(left=0.15)
fig.savefig('kerneldensity.pdf') fig.savefig('kerneldensity.pdf')

View File

@ -8,7 +8,7 @@ x = np.arange(-4.0, 4.0, 0.01)
g = np.exp(-0.5*x*x)/np.sqrt(2.0*np.pi) g = np.exp(-0.5*x*x)/np.sqrt(2.0*np.pi)
r = rng.randn(100) r = rng.randn(100)
fig, (ax1, ax2) = plt.subplots(1, 2) fig, (ax1, ax2) = plt.subplots(1, 2, figsize=cm_size(figure_width, 1.1*figure_height))
ax1.set_xlabel('x') ax1.set_xlabel('x')
ax1.set_xlim(-3.2, 3.2) ax1.set_xlim(-3.2, 3.2)
ax1.set_xticks(np.arange(-3.0, 3.1, 1.0)) ax1.set_xticks(np.arange(-3.0, 3.1, 1.0))
@ -24,8 +24,12 @@ ax2.set_ylabel('Probab. density p(x)')
ax2.set_ylim(0.0, 0.44) ax2.set_ylim(0.0, 0.44)
ax2.set_yticks(np.arange(0.0, 0.41, 0.1)) ax2.set_yticks(np.arange(0.0, 0.41, 0.1))
ax2.plot(x, g, zorder=-1, **lsA) ax2.plot(x, g, zorder=-1, **lsA)
ax2.hist(r, 5, density=True, zorder=-10, **fsB) if mpl_major > 1:
ax2.hist(r, 20, density=True, zorder=-5, **fsC) ax2.hist(r, 5, density=True, zorder=-10, **fsB)
ax2.hist(r, 20, density=True, zorder=-5, **fsC)
else:
ax2.hist(r, 5, normed=True, zorder=-10, **fsB)
ax2.hist(r, 20, normed=True, zorder=-5, **fsC)
fig.savefig('pdfhistogram.pdf') fig.savefig('pdfhistogram.pdf')

View File

@ -10,7 +10,7 @@ x2=1.0
fig, ax = plt.subplots(figsize=cm_size(figure_width, 1.2*figure_height)) fig, ax = plt.subplots(figsize=cm_size(figure_width, 1.2*figure_height))
ax.set_xlabel('x') ax.set_xlabel('x')
ax.set_ylabel('Probability density p(x)') ax.set_ylabel('Prob. density p(x)')
ax.set_ylim(0.0, 0.46) ax.set_ylim(0.0, 0.46)
ax.set_yticks(np.arange(0.0, 0.45, 0.1)) ax.set_yticks(np.arange(0.0, 0.45, 0.1))
ax.annotate('Gaussian', ax.annotate('Gaussian',