n1.binSize = 1 n1.histo(verbose=False, padMin=-3, padMax=15.) n2 = Numbers(nv2) n2.binSize = 1 n2.histo(verbose=False, padMin=-3, padMax=15.) # prepare the binNames, and extract the histo values into separate # lists. binNames = [] vals1 = [] vals2 = [] for bNum in range(n1.nBins - 1): binNames.append('%i' % int(n1.bins[bNum][0])) vals1.append(float(n1.bins[bNum][1])) vals2.append(float(n2.bins[bNum][1])) assert len(binNames) == len(vals1) assert len(vals1) == len(vals2) gp = Plot() gp.baseName = 'twoBarsB' gp.bars(binNames, [vals1, vals2]) gp.barValAxis.title = None gp.barNameAxis.title = None gp.maxBarValToShow = 800. gp.barNameAxis.barLabelsEvery = 2 gp.barNameAxis.barLabelsSkipFirst = 1 gp.barNameAxis.textRotate = 90 gp.png() gp.svg()
from gram import Plot read('data5.py') gp = Plot() gp.baseName = 'lineAndBar_better' c = gp.bars(binNames, binVals) c.barSets[0].fillColor = 'black!10' gp.minBarValToShow = 0.0 gp.barNameAxis.title = None gp.barValAxis.title = 'frequency' gp.barNameAxis.barLabelsEvery = 2 gp.line(xx1, yy1, smooth=True) gp.xAxis.position = 't' gp.yAxis.position = 'r' gp.xAxis.title = None gp.xAxis.tickLabelsEvery = 2 gp.yAxis.title = 'density' gp.png() gp.svg() # line plot is not smooth
# Prepare the numbers, using p4.Numbers. Make the padMin and padMax # the same for both data, so that the histo lists are the same size. n1 = Numbers(nv1) n1.binSize = 1 n1.histo(verbose=False,padMin=-3, padMax=15.) n2 = Numbers(nv2) n2.binSize = 1 n2.histo(verbose=False, padMin=-3, padMax=15.) # prepare the binNames, and extract the histo values into separate # lists. binNames = [] vals1 = [] vals2 = [] for bNum in range(n1.nBins): binNames.append('%i' % int(n1.bins[bNum][0])) vals1.append(float(n1.bins[bNum][1])) vals2.append(float(n2.bins[bNum][1])) assert len(binNames) == len(vals1) assert len(vals1) == len(vals2) gp = Plot() gp.baseName = 'twoBarsA' gp.bars(binNames, [vals1, vals2]) gp.barValAxis.title = None gp.barNameAxis.title = None gp.png() gp.svg()
from gram import Plot read("data2.py") gp = Plot() gp.baseName = 'barA' gp.bars(xx1, yy1) gp.png() gp.svg()
from gram import Plot read("data2.py") gp = Plot() gp.baseName = 'barB' gp.font = 'helvetica' c = gp.bars(xx1, yy1) # c.barSets[0].fillColor = 'violet!20' gp.barValAxis.title = 'gnat infestations' gp.barNameAxis.title = None #gp.barValAxis.position = 'r' #gp.barNameAxis.position = 't' gp.minBarValToShow = 0. gp.maxBarValToShow = 80. gp.barNameAxis.textRotate = 44 # gp.png() gp.png() gp.svg()
from gram import Plot read("data2.py") gp = Plot() gp.baseName = 'barB' c = gp.bars(xx1, yy1) # c.barSets[0].fillColor = 'violet!20' gp.barValAxis.title = 'gnat infestations' gp.barNameAxis.title = None #gp.barValAxis.position = 'r' #gp.barNameAxis.position = 't' gp.minBarValToShow = 0. gp.maxBarValToShow = 80. gp.barNameAxis.textRotate = 44 # gp.png() gp.png() gp.svg()
from gram import Plot from data5 import xx1, yy1, binNames, binVals gp = Plot() gp.baseName = 'lineAndBar_good' c = gp.bars(binNames,binVals) gp.minBarValToShow = 0.0 gp.barNameAxis.title = None gp.barValAxis.title = 'frequency' c.barSets[0].fillColor = 'black!10' gp.barNameAxis.barLabelsEvery = 2 #gp.barNameAxis.textRotate = 90 gp.line(xx1, yy1, smooth=True) gp.xAxis.position = 't' gp.yAxis.position = 'r' gp.xAxis.title = None gp.yAxis.title = 'density' gp.maxXToShow = 4.0 gp.xAxis.tickLabelsEvery = 1 gp.maxBarValToShow = 5000 gp.maxYToShow = 1.0 gp.font = 'helvetica' gp.png() gp.svg()
from gram import Plot read("data2.py") gp = Plot() gp.font = 'helvetica' gp.baseName = 'barA' gp.bars(xx1, yy1) gp.png() gp.svg()