Beispiel #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()
Beispiel #2
0
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')
dislin.curve(x, y1, n)
Beispiel #3
0
#! /usr/bin/env python
import dislin

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.)
Beispiel #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()
Beispiel #5
0
#!/usr/bin/env python
import dislin

xray = [1., 2.5, 2., 2.7, 1.8]

ctit = 'Pie Charts (PIEGRF)'

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

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)
Beispiel #6
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()