예제 #1
0
g = gp.line(xx1, yy1b)
g.colour = 'green'

g = gp.line(yy1a, xx1)
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'
예제 #2
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
예제 #3
0
파일: plotMarks.py 프로젝트: pgfoster/gram
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])
예제 #4
0
파일: xyText.py 프로젝트: pgfoster/gram
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.
예제 #5
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])
예제 #6
0
        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'
        else:
            gp.yAxis.title = None
            gp.yAxis.styles.remove('ticks')
        gp.gX = j * 3.2
        gp.gY = i * -2.7
        gg.append(gp)
예제 #7
0
파일: hyperbolas.py 프로젝트: pgfoster/gram
g = gp.line(xx1, yy1b)
g.colour = 'green'

g = gp.line(yy1a, xx1)
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'
예제 #8
0
파일: textInPlot.py 프로젝트: pgfoster/gram
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
예제 #9
0
import math
from gram import Plot
gp = Plot()
gp.baseName = 'xyText'
# make an invisible plot
xx = 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()  # yuk!