python - Hiding the y-axis in this plot -


simple question: need hide y-axis plot generated code:

import matplotlib.pyplot plt import seaborn seaborn.set(style="white") import random  objects = [("zachary's karate club", 78),             ("dolphins social network", 159),             ("c. elegans connectome", 2148 ),             ("us power grid", 6594 ),             ("pgp web of trust (2004)", 24316),             ("linux kernel source file includes", 230213),             ("enron emails (1999-2003)", 1148072),             ("internet autonomous systems (2005)", 11095298),             ("cs collaborations (dblp)", 18e6),             ("wikipedia hyperlinks", 350e6),             ("twitter follower graph (2012)", 20e9),             ("facebook social graph (2011)", 68.7e9),             ("nsa social graph (?)", 1e11),             ("human connectome (neuronal)", 1e14)            ]  fig, ax = plt.subplots(figsize=(16,6))  i, (name, radius) in enumerate(objects):     sgn = 2 * (i % 2) - 1     ax.annotate(name, xy=(radius,0), xytext=(radius,sgn* (0.5 + random.randint(1,12) * 0.1)), ha='center',                 arrowprops=dict(arrowstyle="->", connectionstyle="arc,anglea=0,arma=30,rad=30", facecolor='gray'),                color="maroon") ax.set_xscale('log') ax.set_xlim(1.e1,1.e15) ax.set_ylim(0,4) ax.axes.get_yaxis().set_visible(false) ax.axhline(color='k', lw=1) ax.plot([obj[1] obj in objects], [0]*len(objects), 'ob', markersize=2) ax.set_yticks([]) ax.tick_params(length=8) ax.set_xlabel('edges') seaborn.despine() plt.show() 

enter image description here

should simple enough, code examples i've found far have not worked, e.g. fig.axes[0].get_yaxis().set_visible(false)

the left axis seaborn, not matplotlib. can turn off using:

seaborn.despine(left=true) 

in response tcaswell comment bellow:

seaborn adds splines plot. despine command accepts following args remove them. however, have explicitly tell turn off left or bottom.

seaborn.despine(fig=none, ax=none, top=true, right=true, left=false, bottom=false, offset=none, trim=false) 

wherein

top, right, left, bottom : boolean, optional if true, remove spine. 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -