# Plots a bar graph of the environments of streams and clouds
import matplotlib
import matplotlib.pyplot as plt; plt.rcdefaults()
import numpy as np
import matplotlib.pyplot as plt

# LaTeX like fonts in the figure
#plt.rc('text', usetex=True)
plt.rc('font', family='serif')
#plt.rc('font', serif='Palatino')
#plt.rc('font', cursive='Zapf Chancery')
#plt.rc('font', monospace='Courier')

matplotlib.rcParams['xtick.labelsize'] = 12 
matplotlib.rcParams['ytick.labelsize'] = 12

from matplotlib.ticker import AutoMinorLocator
XminorLocator = AutoMinorLocator()
YminorLocator = AutoMinorLocator()

csfont = {'fontname':'Liberation Serif','fontsize':505}
plt.ylabel('Percentage')
plt.xlabel('Environment')

 
objects = ('Void','Field','Pairs /\nTriples','Groups','Clusters')
y_pos = np.arange(len(objects))
streams = [2.3,11.6,44.2,30.3,11.6]
darkclouds = [0.0,3.9,0.0,58.8,37.3]

 
plt.bar(y_pos, darkclouds, width = 1.0, align='center', color = 'red', label = 'Clouds')
plt.bar(y_pos, streams, width = 1.0, align='center', label = 'Streams', fill = False, hatch="/", color = 'blue')

plt.xticks(y_pos, objects)

# Get rid of tick marks on x axis
ax = plt.axes()
ax.xaxis.set_ticks_position('none') 

plt.gca().set_aspect(6.0/60.0,adjustable='box')

axes = plt.gca()
#axes.xaxis.set_minor_locator(XminorLocator)
axes.yaxis.set_minor_locator(YminorLocator)

plt.savefig('HIEnvironments.png',dpi=100,facecolor='white',bbox_inches='tight')
 
#plt.show()

