Exemplo n.º 1
0
    r"$x\left(1+x^2\right)^{-\frac{1}{2}}$",
    r"$\frac{2}{\pi}\mathrm{arctan}\left( \frac{\pi}{2}x \right)$",
    r"$x\left(1+|x|\right)^{-1}$"
]

for i in range(1, 7):
    s = "ax.plot(x,y%s(x),color=colors[i-1])" % (str(i))
    eval(s)
ax.legend(leg_list, loc="best", ncol=2,
          fancybox=True)  # title="Legend", fontsize=12
# ax.grid(True, which='both')
ax.set_aspect('equal')
ax.set_xlim([-3.1, 3.1])
ax.set_ylim([-1.1, 1.1])

ax.annotate('1', xy=(0.08, 1 - 0.02))
ax.annotate('0', xy=(0.08, -0.2))
ax.annotate('-1', xy=(0.08, -1 - 0.03))

for i in [-3, -2, -1, 1, 2, 3]:
    ax.annotate('%s' % str(i), xy=(i - 0.03, -0.2))

maybe = raw_input(
    "\nUpdate figure directly in master thesis?\nEnter 'YES' (anything else = ONLY show to screen) "
)
if maybe == "YES":  # Only save to disc if need to be updated
    filenameWithPath = "/Users/haakonvt/Dropbox/uio/master/latex-master/Illustrations/six_sigmoids.pdf"
    plt.savefig(filenameWithPath, bbox_inches='tight')  #, pad_inches=0.2)
    print 'Saved over previous file in location:\n "%s"' % filenameWithPath
else:
    print 'Figure was only shown on screen.'
Exemplo n.º 2
0
    tunneling_wave(t, x1, x2, omega, amplitude1, amplitude2) for t in from_x2
]

colors = initialize_graphics()

fig = plt.figure(1)
ax = SubplotZero(fig, 111)
fig.add_subplot(ax)
#fig, ax = plt.subplots()
fig.set_size_inches(cm2inch([10, 5]))

ax.plot(full_range, potential, lw=2, color=colors[2])
ax.plot(until_x1, wave_until_x1, lw=2, color=colors[0])
ax.plot(from_x2, wave_from_x2, lw=2, color=colors[0])

ax.annotate('$U(x)$', xy=(x2, V0), xytext=(x2 + 0.3, V0 - 0.2))

ax.set_frame_on(False)
#ax.axes.get_yaxis().set_visible(False)
ax.axes.get_xaxis().set_ticks([x1, x2, 5 * np.pi + 0.5])
ax.axes.get_xaxis().set_ticklabels(['$x_1$', '$x_2$', '$x$'])
ax.axis["xzero"].set_axisline_style("-|>")
ax.axis["xzero"].set_visible(True)
ax.axis["yzero"].set_visible(False)

for direction in ["left", "right", "bottom", "top"]:
    ax.axis[direction].set_visible(False)

ax.set_xlim([-0.5, 5 * np.pi + 0.5])

plt.savefig('./quantum_tunneling.pdf')
wave_from_x2 = [tunneling_wave(t, x1, x2, omega, amplitude1, amplitude2) for t in from_x2]


colors=initialize_graphics()

fig = plt.figure(1)
ax = SubplotZero(fig, 111)
fig.add_subplot(ax)
#fig, ax = plt.subplots()
fig.set_size_inches(cm2inch([10,5]))

ax.plot(full_range, potential, lw=2, color=colors[2])
ax.plot(until_x1, wave_until_x1, lw=2, color=colors[0])
ax.plot(from_x2, wave_from_x2, lw=2, color=colors[0])

ax.annotate('$U(x)$', xy=(x2, V0), xytext=(x2+0.3, V0-0.2))

ax.set_frame_on(False)
#ax.axes.get_yaxis().set_visible(False)
ax.axes.get_xaxis().set_ticks([x1, x2, 5*np.pi+0.5])
ax.axes.get_xaxis().set_ticklabels(['$x_1$','$x_2$', '$x$'])
ax.axis["xzero"].set_axisline_style("-|>")
ax.axis["xzero"].set_visible(True)
ax.axis["yzero"].set_visible(False)

for direction in ["left", "right", "bottom", "top"]:
    ax.axis[direction].set_visible(False)

ax.set_xlim([-0.5, 5*np.pi+0.5])

plt.savefig('./quantum_tunneling.pdf')