Skip to content

Instantly share code, notes, and snippets.

@joennlae
Created August 27, 2018 21:25
Show Gist options
  • Save joennlae/4152d99cc357a565d144bc03c5c93d92 to your computer and use it in GitHub Desktop.
Save joennlae/4152d99cc357a565d144bc03c5c93d92 to your computer and use it in GitHub Desktop.
plotting
#!/usr/bin/env python
# make a horizontal bar chart
# ATTENTION python3 for execution ATTENTION!!!!!!!!
from pylab import *
val = 14 # the bar lengths
pos = arange(1) # the bar centers on the y axis
figure(figsize=(9,1))
plt.gca().xaxis.grid(True)
#ax.set_xticklabels([1,2,3,4,5,6,7,8,9,10,11,12,13])
xlabel('H-Gln-')
plt.gca().set_yticklabels([])
plt.gca().tick_params(axis='both',width=0,length=0)
xlim(0, 14)
plt.xticks(np.arange(0, 15, 1.0))
val1=2.5
val2=1.5
val3=10
#val4=6
#val5=2
barh(pos,val1,color ='red')
barh(pos,val2, left=val1,color='green')
barh(pos,val3, left=val2+val1,color='red')
#barh(pos,val4, left=val3+val2+val1,color='green')
#barh(pos,val5, left=val4+val3+val2+val1,color='red')
#figure(2)
#barh(pos,val, xerr=rand(5), ecolor='r', align='center')
#yticks(pos, ('Tom', 'Dick', 'Harry', 'Slim', 'Jim'))
#xlabel('Performance')
tight_layout()
show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment