Exemplo n.º 1
0
from gram import Plot
from data1 import xx1, yy1
gp = Plot()
gp.baseName = 'line'
gp.line(xx1, yy1)
gp.png()
gp.svg()
   
Exemplo n.º 2
0
from gram import Plot
read("data1.py")
gp = Plot()
gp.baseName = 'noFrame'
gp.line(xx1, yy1)
gp.yAxis.title = None
gp.xAxis.title = None
gp.yAxis.styles.remove('ticks')
gp.xAxis.styles.remove('ticks')
gp.frameT = None
gp.frameB = None
gp.frameL = None
gp.frameR = None
gp.png()
gp.svg()
Exemplo n.º 3
0
from gram import Plot

xx1 = [2.3, 3.5, 7.]
yy1 = [3.3, 1.2, 5.6]

xx2 = [-19.3, -14.3, -10.5]
yy2 = [-2.6, -15.9, -9.3]

gp = Plot()
gp.baseName = 'plotArrayB'
gp.line(xx1, yy1, smooth=True)
gp.scatter(xx1, yy1)
gp.yAxis.title = 'widgets'
gp.xAxis.title = 'time (hours)'
gp.minXToShow = 0.0

gp2 = Plot()
gp2.line(xx2, yy2, smooth=False)
gp2.scatter(xx2, yy2)
gp2.yAxis.title = 'spin'
gp2.yAxis.position = 'r'
gp2.xAxis.title = 'impetus'
gp2.gX = 4.3
gp2.gY = 0.

gp.grams.append(gp2)
gp.png()
gp.svg()  # smooth line plots do not work in svg
Exemplo n.º 4
0
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
Exemplo n.º 5
0
import math
from gram import Plot
gp = Plot()
gp.baseName = 'xyText'
# make an invisible plot
xx = list(range(17))
yy = [math.sin(x) for x in xx]
c = gp.line(xx, yy)
c.colour = 'green'
# make some text at x,y
for i in range(len(xx)):
    c = gp.xYText(xx[i],yy[i],'%i' % i)
    c.shape = 'circle'
    c.fill = 'red!10'
    c.rotate = i * 15
gp.contentSizeX = 5.
# remove the axes and frame
gp.yAxis.title = None 
gp.xAxis.title = None 
gp.yAxis.styles.remove('ticks') 
gp.xAxis.styles.remove('ticks')
gp.frameT = None 
gp.frameB = None 
gp.frameL = None 
gp.frameR = None 
gp.png() 
gp.svg()  # squares, not circles.
Exemplo n.º 6
0
g.colour = 'blue'
g = gp.line(yy1b, xx1)
g.color = 'blue'

g = gp.line([-4, 4], [-4, 4])
g.color = 'red'
g = gp.line([-4, 4], [4, -4])
g.colour = 'red'

myTextSize = 'tiny'
l1 = r'$y^2 + x^2 = 1$'
g = gp.xYText(-2, 2.5, l1)
g.anchor = 'west'
g.textSize = myTextSize

l1 = r'$x^2 - y^2 = 1$'
g = gp.xYText(1.5, 1., l1)
g.anchor = 'west'
g.textSize = myTextSize

howBig = 3.5
gp.contentSizeX = howBig
gp.contentSizeY = howBig
gp.xAxis.title = None
gp.yAxis.title = None
gp.yAxis.sig = '%.1f'
gp.baseName = 'hyperbolas'
gp.png()
gp.svg() # does not work, due to latex math

Exemplo n.º 7
0
from gram import Plot
from data5 import xx1, yy1, binNames, binVals
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.font = 'helvetica'
gp.svg() # line plot is not smooth