Example #1
0
from gram import Plot
xx1 = [2,4,7,3,9]
yy1 = [4,5,1,7,4]
gp = Plot()
gp.baseName = 'linesInPlot'
gp.scatter(xx1, yy1, plotMark='diamond')
gp.minXToShow = 0.0
g = gp.lineFromSlopeAndIntercept(1, 2)
g.lineThickness = 'thick'
gp.verticalLine(x=3, y=4)
c = gp.verticalLine(8)
c.colour = 'gray'
c.lineThickness = 'very thick'
gp.xAxis.title = None
gp.yAxis.title = None
gp.png()
gp.svg()
Example #2
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
Example #3
0
from gram import Plot

xx1 = [2, 4, 7, 3, 9]
yy1 = [4, 5, 1, 7, 4]
gp = Plot()
gp.contentSizeX = 2
gp.contentSizeY = 1.5
gp.baseName = 'textInPlot'
gp.scatter(xx1, yy1, plotMark='asterisk')
c = gp.xYText(7, 1.2, r'$\Downarrow$')
c.anchor = 'south'
c = gp.xYText(3.3, 7, r'$\leftarrow$\ Ignore this point')
c.textSize = 'tiny'
c.anchor = 'west'
gp.xAxis.title = None
gp.yAxis.title = None
gp.png()
# gp.svg()  # looks bad, the latex text is not rendered
Example #4
0
from gram import Plot

markerShapes = ['+', 'x', '*', '-', '|', 'o', 'asterisk',
                'square', 'square*', 'triangle',
                'triangle*', 'diamond', 'diamond*']

gp = Plot()
gp.baseName = 'plotMarks'
for mShNum in range(len(markerShapes)):
    xx = [5]
    yy = [len(markerShapes) - mShNum]
    myMarker = markerShapes[mShNum]
    gp.scatter(xx, yy, plotMark=myMarker)
    g = gp.xYText(0, yy[0], myMarker)
    g.textFamily = 'ttfamily'
    g.anchor = 'west'

    xx = [6]
    g = gp.scatter(xx, yy, plotMark=myMarker)
    g.color = 'red'

    xx = [7]
    g = gp.scatter(xx, yy, plotMark=myMarker)
    g.fill = 'red'

    xx = [8]
    g = gp.scatter(xx, yy, plotMark=myMarker)
    g.color = 'blue'
    g.fill = 'yellow'

gp.line([4.5,8.5], [14, 14])
Example #5
0
from gram import Plot
read("data6.py")
read("data6b.py")
gp = Plot()
gp.baseName = 'regression'
gp.scatter(xx1, yy1, plotMark='square')
g = gp.line(xx2, yy2, smooth=True)
g.lineThickness = 'thick'
gp.maxYToShow=100
gp.minXToShow=-2
gp.xAxis.title = None
gp.yAxis.title = None
gp.png()
gp.svg()

Example #6
0
from gram import Plot

markerShapes = ['+', 'x', '*', '-', '|', 'o', 'asterisk',
                'square', 'square*', 'triangle',
                'triangle*', 'diamond', 'diamond*']

gp = Plot()
gp.baseName = 'plotMarks'
for mShNum in range(len(markerShapes)):
    xx = [5]
    yy = [len(markerShapes) - mShNum]
    myMarker = markerShapes[mShNum]
    gp.scatter(xx, yy, plotMark=myMarker)
    g = gp.xYText(0, yy[0], myMarker)
    g.textFamily = 'ttfamily'
    g.anchor = 'west'

    xx = [6]
    g = gp.scatter(xx, yy, plotMark=myMarker)
    g.color = 'red'

    xx = [7]
    g = gp.scatter(xx, yy, plotMark=myMarker)
    g.fill = 'red'

    xx = [8]
    g = gp.scatter(xx, yy, plotMark=myMarker)
    g.color = 'blue'
    g.fill = 'yellow'

gp.line([4.5,8.5], [14, 14])
Example #7
0
from gram import Plot
read("data1.py")
gp = Plot()
gp.svgPxForCm = 100
gp.baseName = 'scatter'
gp.scatter(xx1, yy1)
gp.yAxis.title = 'scratches'
gp.xAxis.title = 'itches'
gp.minXToShow = 0
gp.maxXToShow = 12
gp.minYToShow = 0.
gp.maxYToShow = 34
gp.png()
gp.svg()
   
Example #8
0
plotmarks = ['o', 'square',
             'triangle', 'diamond']
gg = []
for i in [0,1]:
    for j in [0,1]:
        xx1 = []
        yy1 = []
        for k in range(23):
            xx1.append(random.random())
            yy1.append(random.random())

        gp = Plot()
        gp.contentSizeX = 2.5
        gp.contentSizeY = 2.
        thePlotMark = plotmarks[(2 * i) +j]
        c = gp.scatter(xx1, yy1,
                       plotMark=thePlotMark)
        gp.minXToShow = 0.0
        gp.minYToShow = 0.0
        gp.maxXToShow = 1.0
        gp.maxYToShow = 1.0
        theText = '[%i.%i]' % (i, j)
        c = gp.xYText(0.5, 0.5, theText)
        c.colour = 'blue'

        if i == 0:
            gp.xAxis.title = None
            gp.xAxis.styles.remove('ticks') 
        else:
            gp.xAxis.title = 'xx1'
        if j == 0:
            gp.yAxis.title = 'yy1'
Example #9
0
from gram import Plot
xx1 = [2,4,7,3,9]
yy1 = [4,5,1,7,4]
gp = Plot()
gp.contentSizeX = 2
gp.contentSizeY = 1.5
gp.baseName = 'textInPlot'
gp.scatter(xx1, yy1, plotMark='asterisk')
c = gp.xYText(7, 1.2, r'$\Downarrow$')
c.anchor = 'south'
c = gp.xYText(3.3, 7,
      r'$\leftarrow$\ Ignore this point')
c.textSize = 'tiny'
c.anchor = 'west'
gp.xAxis.title = None
gp.yAxis.title = None
gp.png()
# gp.svg()  # looks bad, the latex text is not rendered
Example #10
0
from gram import Plot
xx1 = [2,4,7,3,9]
yy1 = [4,5,1,7,4]
gp = Plot()
gp.baseName = 'linesInPlot'
gp.scatter(xx1, yy1, plotMark='diamond')
gp.minXToShow = 0.0
g = gp.lineFromSlopeAndIntercept(1, 2)
g.lineThickness = 'thick'
gp.verticalLine(x=3, y=4)
c = gp.verticalLine(8)
c.colour = 'gray'
c.lineThickness = 'very thick'
gp.xAxis.title = None
gp.yAxis.title = None
gp.font = 'helvetica'
gp.png()
gp.svg()