def make_zerocross_axes(figsize, loc): fig = plt.figure(figsize=figsize) ax = SubplotZero(fig, loc) ax.set_aspect("equal") fig.add_subplot(ax) for direction in ["xzero", "yzero"]: axis = ax.axis[direction] axis.set_visible(True) for direction in ["left", "right", "bottom", "top"]: ax.axis[direction].set_visible(False) return ax
def make_zerocross_axes(figsize, loc): from matplotlib import pyplot as plt from mpl_toolkits.axes_grid.axislines import SubplotZero fig = plt.figure(figsize=figsize) ax = SubplotZero(fig, loc) ax.set_aspect("equal") fig.add_subplot(ax) for direction in ["xzero", "yzero"]: axis = ax.axis[direction] axis.set_visible(True) for direction in ["left", "right", "bottom", "top"]: ax.axis[direction].set_visible(False) return ax
def make_zerocross_axes(figsize, loc): from matplotlib import pyplot as plt from mpl_toolkits.axes_grid.axislines import SubplotZero fig = plt.figure(figsize=figsize) ax = SubplotZero(fig, loc) ax.set_aspect("equal") fig.add_subplot(ax) for direction in ["xzero", "yzero"]: axis = ax.axis[direction] axis.set_visible(True) for direction in ["left", "right", "bottom", "top"]: ax.axis[direction].set_visible(False) return ax
# Set up the figure, the axis, and the plot element we want to animate # ######################## fig = plt.figure(1) Sig_max = 500.0 # Espace x,y ax1 = SubplotZero(fig, 121) fig.add_subplot(ax1) # for direction in ["xzero", "yzero"]: ax1.axis[direction].set_axisline_style("-|>") ax1.axis[direction].set_visible(True) # for direction in ["left", "right", "bottom", "top"]: ax1.axis[direction].set_visible(False) ax1.set_aspect('equal') ax1.set_xlim(-Sig_max, Sig_max) ax1.set_ylim(-Sig_max, Sig_max) ax1.text(0., 1.05, 'y', size=20, transform=BlendedGenericTransform(ax1.transData, ax1.transAxes)) ax1.text(1.05, -0.15, 'x', size=20, transform=BlendedGenericTransform(ax1.transAxes, ax1.transData)) vec_phi_xy = ax1.quiver(0,
leg_list = [ r"$\mathrm{erf}\left(\frac{\sqrt{\pi}}{2}x \right)$", r"$\tanh(x)$", r"$\frac{2}{\pi}\mathrm{gd}\left( \frac{\pi}{2}x \right)$", 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"