python - Matplotlib clipping first bar in hbar in half horizontally -


i'm struggling understand why first bar in matplotlib hbar plot being chopping in half horizontally. yaxis label missing bar. idea of why happening?

here script , attached output output of attached script

import networkx nx import matplotlib.pyplot plt matplotlib import cm import numpy np import neptcon nc import sys import pickle  fp = open("c:\python27\internal_reports\\shared.pkl") shared = pickle.load(fp)  con = none  cur, con = nc.connect() cur = con.cursor()    scriptfile = open("c:\python27\internal_reports\ann_report_sql\den diff.sql", 'r') script = scriptfile.read() scriptfile.close()     cur.execute(script.format(**shared)) items = cur.fetchall() client, ship, imo, diff = zip(*items) new_list = [] item in diff:     new_list.append(int(item))           n = len( new_list ) x = range( n )    n_groups = n index = np.arange(n_groups) fig = plt.figure() f, (ax1) = plt.subplots(1, 1, figsize=(8, n/2), sharex=false) bar_width = 0.95 opacity = 0.5 g = nx.complete_graph(10) pos = nx.spring_layout(g)  plt.yticks(index+(bar_width/2), ship, fontsize = 9) ax1.yaxis.grid(true, which='major', color='0.95',linestyle='-') ax1.set_ylim(0, n) ax1.xaxis.set_ticks_position('bottom') ax1.yaxis.set_ticks_position('right') ax1.spines['right'].set_visible(false) ax1.spines['top'].set_visible(false) ax1.spines['left'].set_visible(false) a,b in zip(index,new_list):     plt.text(b, a-0.2, str(b))       plt.barh(a,b,color=cm.autumn(1.*a/len(x)),edgecolor='white') if n > 40:     plt.savefig('{} quan_diff.pdf'.format(shared.get("cl")), format='pdf', bbox_inches='tight') else:     plt.savefig('c:\python27\internal_reports\plots\\quan_diff.png', bbox_inches='tight')  nc.closecon() 


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -