Exemple #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()
Exemple #2
0
def myplot(id):
    xa = -180.
    xe = 180.
    xor = -180.
    xstp = 60.

    ya = -90.
    ye = 90.
    yor = -90.
    ystp = 30.

    isel = dislin.gwglis(id_lis)
    dislin.setxid(id_draw, 'widget')
    dislin.metafl('xwin')
    dislin.disini()
    dislin.erase()
    dislin.complx()

    if (isel >= 4 and isel <= 7):
        dislin.noclip()
    elif (isel == 2):
        ya = -85
        ye = 85
        yor = -60
    elif (isel >= 8 and isel <= 10):
        ya = 0
        ye = 90
        yor = 0

    dislin.labdig(-1, 'xy')
    dislin.name('Longitude', 'x')
    dislin.name('Latitude', 'y')
    dislin.projct(cl2[isel - 1])
    dislin.titlin(cl1[isel - 1] + 'Projection', 3)
    dislin.htitle(50)
    dislin.grafmp(xa, xe, xor, xstp, ya, ye, yor, ystp)
    dislin.title()
    dislin.gridmp(1, 1)
    dislin.color('green')
    dislin.world()
    dislin.unit(0)
    dislin.disfin()
Exemple #3
0
    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')
dislin.curve(x, y1, n)
dislin.curve(x, y2, n)

cbuf = ' '
dislin.legini(cbuf, 2, 7)  # cbuf is a dummy parameter for python
nx = dislin.nxposn(190.)
ny = dislin.nyposn(0.75)
dislin.leglin(cbuf, 'sin (x)', 1)
dislin.leglin(cbuf, 'cos (x)', 2)
Exemple #4
0
ctit = 'Logarithmic Scaling'
clab = ['LOG', 'FLOAT', 'ELOG']

dislin.setpag ('da4p')
dislin.metafl ('cons')

dislin.disini ()
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 ()
Exemple #5
0
stepx = 360. / (n - 1)
stepy = 360. / (m - 1)

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')
Exemple #6
0
for i in range (0, n):
  x = xray[i] * xray[i] - 1.
  x = x * x
  for j in range (0, m):
    y = yray[j] * yray[j] - 1.
    zmat[i*m+j] = x + y * y

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)
Exemple #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()
Exemple #8
0
for i in range (0,n):
  a = (i * step) * f
  y1[i] = a
  x1[i] = math.sin (5*a)

for i in range (0,m):
  x2[i] = i + 1
  y2[i] = i + 1

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

dislin.titlin ('Polar Plots', 2)
dislin.ticks  (3, 'Y')
dislin.axends ('NOENDS', 'X')
dislin.labdig (-1, 'Y')
dislin.axslen (1000, 1000)
dislin.axsorg (1050, 900)

dislin.polar  (1.,0., 0.2, 0., 30.)
dislin.curve  (x1, y1, n)
dislin.htitle (50)
dislin.title  ()
dislin.endgrf ()

dislin.labdig (-1, 'X')
dislin.axsorg (1050, 2250)
dislin.labtyp ('VERT', 'Y')
Exemple #9
0
xray = [
    0., 1., 3., 4.5, 6., 8., 9., 11., 12., 12.5, 13., 15., 16., 17., 19., 20.
]
yray = [2., 4., 4.5, 3., 1., 7., 2., 3., 5., 2., 2.5, 2., 4., 6., 5.5, 4.]
cpol = ['SPLINE', 'BARS', 'STEP', 'LINEAR']

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: