python - Move Y axis to another position in matplotlib -


i have following plot:

normal plot

i want move y axis x = 0 ticks , everything, how can it?

here go

import matplotlib.pyplot plt import numpy np  fig = plt.figure() x = np.linspace(-np.pi, np.pi, 100) y = 2*np.sin(x)  ax = fig.add_subplot(111) ax.set_title('centered spines') ax.plot(x, y) ax.spines['left'].set_position('center') ax.spines['right'].set_color('none') ax.spines['bottom'].set_position('bottom') ax.spines['top'].set_color('none') ax.spines['left'].set_smart_bounds(true) ax.spines['bottom'].set_smart_bounds(true) ax.xaxis.set_ticks_position('bottom') ax.yaxis.set_ticks_position('left') 

more examples:http://matplotlib.org/examples/pylab_examples/spine_placement_demo.html


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -