Пример #1
0
def dislinPlot(xvals, yvals, ylimit):

    # Set the plot output file format
    dislin.metafl(plot_filetype)

    # Dislin routine initialization
    dislin.disini()

    # Set the font type on graph
    dislin.complx()

    # Set the Graph color
    dislin.color(plot_color)

    # Fix the position of axes on graph area
    dislin.axspos(axes_pos_x, axes_pos_y)

    # Fix the length of axes on graph area
    dislin.axslen(axes_len_l, axes_len_h)

    # Set name of axes
    dislin.name(x_axis_name, 'X')
    dislin.name(y_axis_name, 'Y')

    # Num of digits after decimal point ; "-2" refers automatic selection
    dislin.labdig(-2, 'X')

    # Num of ticks on axes b/w values
    dislin.ticks(x_axis_ticks, 'X')
    dislin.ticks(y_axis_ticks, 'Y')

    # Plot title text
    dislin.titlin('y_axis_name vs x_axis_name', 1)

    # Plot details; xlower., xupper., x1stlabel., xstep., ylower., yupper., y1stlabel., ystep
    dislin.graf(0., float(data_samples), 0., float(x_step), 0., float(ylimit),
                0., float(y_step))

    # Write title on plot
    dislin.title()

    # Curve changes if called multiple times
    dislin.chncrv('NONE')

    # Plot the Curve
    dislin.curve(xvals, yvals, data_samples)

    # Dislin routine conclusion
    dislin.disfin()
Пример #2
0
n = 101
f = 3.1415926 / 180.
x = range(n)
y1 = range(n)
y2 = range(n)
for i in range(0, n):
    x[i] = i * 3.6
    v = i * 3.6 * f
    y1[i] = math.sin(v)
    y2[i] = math.cos(v)

dislin.metafl('xwin')
dislin.disini()
dislin.complx()

dislin.axspos(450, 1800)
dislin.axslen(2200, 1200)

dislin.name('X-axis', 'X')
dislin.name('Y-axis', 'Y')

dislin.labdig(-1, 'X')
dislin.ticks(10, 'XY')

dislin.titlin('Demonstration of CURVE', 1)
dislin.titlin('Legend', 3)

dislin.graf(0., 360., 0., 90., -1., 1., -1., 0.5)
dislin.title()

dislin.chncrv('LINE')
Пример #3
0
dislin.pagera ()
dislin.complx ()
dislin.axslen (1400, 500)

dislin.name   ('X-axis', 'X')
dislin.name   ('Y-axis', 'Y')
dislin.axsscl ('LOG', 'XY')

dislin.titlin (ctit, 2)

for i in range (0, 3):
  nya = 2650 - i * 800
  dislin.labdig (-1, 'XY')
  if i == 1:
    dislin.labdig (1, 'Y')
    dislin.name   (' ', 'X')

  dislin.axspos (500, nya)
  dislin.messag ('Labels: ' + clab[i], 600, nya - 400)
  dislin.labels (clab[i], 'XY')
  dislin.graf   (0., 3., 0., 1., -1., 2., -1., 1.)
  if i == 2:
    dislin.height (50)
    dislin.title ()

  dislin.endgrf ()

dislin.disfin ()


Пример #4
0
for i in range(0, n):
    x = i * stepx
    for j in range(0, m):
        y = j * stepy
        zmat[i * m + j] = 2 * math.sin(x * fpi) * math.sin(y * fpi)

dislin.metafl('cons')
dislin.setpag('da4p')
dislin.disini()
dislin.pagera()
dislin.complx()

dislin.titlin(ctit1, 2)
dislin.titlin(ctit2, 4)

dislin.axspos(200, 2600)
dislin.axslen(1800, 1800)

dislin.name('X-axis', 'X')
dislin.name('Y-axis', 'Y')
dislin.name('Z-axis', 'Z')

dislin.view3d(-5., -5., 4., 'ABS')
dislin.graf3d(0., 360., 0., 90., 0., 360., 0., 90., -3., 3., -3., 1.)
dislin.height(50)
dislin.title()

dislin.color('green')
dislin.surmat(zmat, n, m, 1, 1)
dislin.disfin()
Пример #5
0
dislin.axslen(1600, 1000)
dislin.titlin(ctit, 2)

cbuf = ' '
dislin.legini(cbuf, 5, 8)
dislin.leglin(cbuf, 'FIRST', 1)
dislin.leglin(cbuf, 'SECOND', 2)
dislin.leglin(cbuf, 'THIRD', 3)
dislin.leglin(cbuf, 'FOURTH', 4)
dislin.leglin(cbuf, 'FIFTH', 5)

# Selecting shading patterns
dislin.patcyc(1, 7)
dislin.patcyc(2, 4)
dislin.patcyc(3, 13)
dislin.patcyc(4, 3)
dislin.patcyc(5, 5)

dislin.axspos(250, 2800)
dislin.piegrf(cbuf, 1, xray, 5)
dislin.endgrf()

dislin.axspos(250, 1600)
dislin.labels('DATA', 'PIE')
dislin.labpos('EXTERNAL', 'PIE')
dislin.piegrf(cbuf, 1, xray, 5)

dislin.height(50)
dislin.title()
dislin.disfin()
Пример #6
0
dislin.metafl ('cons')
dislin.setpag ('da4p')

dislin.disini ()
dislin.pagera ()
dislin.complx ()
dislin.mixalf ()

dislin.titlin (ctit1, 1)
dislin.titlin (ctit2, 3)

dislin.name   ('X-axis', 'X')
dislin.name   ('Y-axis', 'Y')

dislin.axspos (450, 2670)
dislin.shdmod ('poly', 'contur')
dislin.graf   (0., 1.6, 0., 0.2, 0., 1.6, 0., 0.2)

for i in range (0, 12):
  zlev[11-i] = 0.1 + i * 0.1

dislin.conshd (xray, n, yray, m, zmat, zlev, 12)

dislin.height (50)
dislin.title  ()

dislin.disfin ()


Пример #7
0
#! /usr/bin/env python
import dislin

dislin.metafl('xwin')
dislin.disini()
dislin.pagera()
dislin.complx()

dislin.axspos(400, 1850)
dislin.axslen(2400, 1400)

dislin.name('Longitude', 'X')
dislin.name('Latitude', 'Y')
dislin.titlin('World Coastlines and Lakes', 3)

dislin.labels('MAP', 'XY')
dislin.labdig(-1, 'XY')
dislin.grafmp(-180., 180., -180., 90., -90., 90., -90., 30.)

dislin.gridmp(1, 1)
dislin.color('green')
dislin.world()

dislin.color('foreground')
dislin.height(50)
dislin.title()
dislin.disfin()
Пример #8
0
ctit1 = 'Surface Plot of the Parametric Function'
ctit2 = '[COS(t)*(3+COS(u)), SIN(t)*(3+COS(u)), SIN(u)]'

pi = 3.1415927

dislin.scrmod('revers')
dislin.metafl('cons')
dislin.setpag('da4p')
dislin.disini()
dislin.pagera()
dislin.complx()

dislin.titlin(ctit1, 2)
dislin.titlin(ctit2, 4)

dislin.axspos(200, 2400)
dislin.axslen(1800, 1800)

dislin.name('X-axis', 'X')
dislin.name('Y-axis', 'Y')
dislin.name('Z-axis', 'Z')
dislin.intax()

dislin.vkytit(-300)
dislin.zscale(-1., 1.)
dislin.surmsh('on')

dislin.graf3d(-4., 4., -4., 1., -4., 4., -4., 1., -3., 3., -3., 1)
dislin.height(40)
dislin.title()
Пример #9
0
    zmat[i*m+j] = 2 * math.sin(x * fpi) * math.sin(y * fpi)

dislin.metafl ('xwin')
dislin.disini ()
dislin.pagera ()
dislin.complx ()

dislin.titlin (ctit1, 1)
dislin.titlin (ctit2, 3)

dislin.name   ('X-axis', 'X')
dislin.name   ('Y-axis', 'Y')
dislin.name   ('Z-axis', 'Z')

dislin.intax  ()
dislin.autres (n, m)
dislin.axspos (300, 1850)
dislin.ax3len (2200, 1400, 1400)

dislin.graf3   (0., 360., 0., 90., 0., 360., 0., 90.,
                -2., 2., -2., 1.)
dislin.crvmat (zmat, n, m, 1, 1)
dislin.height (50)
dislin.title  ()
dislin.disfin ()





Пример #10
0
dislin.setpag('da4p')
dislin.metafl('cons')

dislin.disini()
dislin.pagera()
dislin.complx()

dislin.incmrk(1)
dislin.hsymbl(25)
dislin.titlin(ctit, 1)
dislin.axslen(1500, 500)
dislin.setgrf('LINE', 'LINE', 'LINE', 'LINE')

nya = 2700
for i in range(0, 4):
    dislin.axspos(350, nya - i * 500)
    dislin.polcrv(cpol[i])
    dislin.marker(0)
    dislin.graf(0., 20., 0., 5., 0., 10., 0., 5.)
    nx = dislin.nxposn(1.)
    ny = dislin.nyposn(8.)
    dislin.messag(cpol[i], nx, ny)
    dislin.curve(xray, yray, 16)

    if i == 3:
        dislin.height(50)
        dislin.title()

    dislin.endgrf()

dislin.disfin()
Пример #11
0
    x = xray[i] * fpi
    for j in range(0, m):
        y = yray[j] * fpi
        zmat[i * m + j] = 2 * math.sin(x) * math.sin(y)

dislin.metafl('cons')
dislin.setpag('da4p')
dislin.disini()
dislin.pagera()
dislin.complx()

dislin.titlin(ctit1, 1)
dislin.titlin(ctit2, 3)

dislin.intax()
dislin.axspos(450, 2650)

dislin.name('X-axis', 'X')
dislin.name('Y-axis', 'Y')

dislin.graf(0., 360., 0., 90., 0., 360., 0., 90.)
dislin.height(50)
dislin.title()

dislin.height(30)
for i in range(0, 9):
    zlev = -2. + i * 0.5
    if i == 4:
        dislin.labels('NONE', 'CONTUR')
    else:
        dislin.labels('FLOAT', 'CONTUR')