Package of f90 MATLAB-style callable routines for plain graphics and few calling examples. RGB color scheme used (True Color mode supported). Compile in DVF (5.x or higher) environment (e.g. as Quick Win Appl.)

Last modified: 3/24/1999

Bugs to Valery E.Grikurov:

Free for any use. However, $5 check will be appreciated and supports further developments

Thanks, Valery

Dr Valery E. Grikurov
Dept. Math. & Comp.Phys., Inst. on Phys.,St.Petersburg Univ.,Uljanovskaia 1, Petrodvoretz, 198504 Russia
fax : 812-428-7240

  • Download mPlot.f90

  • Package guidelines


    integer(4), parameter :: DW = 33

    Descriptor of Dialog Window, may be any integer
    larger the number of "open" statements in your code

    integer(4) nfig

    Graph windows counte

    integer(4) bkclr /0/

    Initial background color (0 - black, 1 - white)

    logical(4) ifhold /.FALSE./

    .TRUE. if hold is on, .FALSE. otherwise

    logical(4) ifgrid /.FALSE./

    .TRUE. if grid is on, .FALSE. otherwise

    logical(4) ifaxis /.TRUE./

    .TRUE. for default axis behavior, .FALSE. otherwise

    integer(4) dummy

    Dummy integer


    subroutine axis(limits,drawing)
    real(4), optional :: limits(4)
    integer(4), optional :: drawing(2)

    Default axis behaviour is as follows:
    1) limits set to data range
    2) drawing of axis with reasonable number of ticks
    call axis( (/x1,x2,y1,y2/) ) set axis limits to [x1,x2], [y1,y2] unless and/or, while x1.eq.x2 and/or y1.eq.y2 set limits to data range
    call axis( (/x1,x2,y1,y2/), (/ 0, 0/) ) is equivalent to previous line
    call axis( (/x1,x2,y1,y2/), (/ 1, 1/) ) set limits but suppress axis drawing
    call axis( (/x1,x2,y1,y2/), (/-1,-1/) ) set limits but suppress ticks
    call axis() restores axis behavior to default
    WARNING: use "axis" before calling plot

    subroutine delete(handle)
    integer(4) handle

    Same as close(handle)

    subroutine figure(handle)
    integer(4) handle

    Directs output to graph window "handle"

    subroutine hold(toggle)
    character*(*), optional :: toggle

    call hold('on') toggles hold to 'ON'
    call hold('off') toggles hold to 'OFF'
    call hold() displays hold status

    subroutine grid(toggle)
    character*(*), optional :: toggle

    call grid('on') toggles grid to 'ON'
    call grid('off') toggles grid to 'OFF'
    call grid() displays grid status

    subroutine legend(string,attr,pos)
    character*(*) string
    character*(*) attr
    integer(4), optional :: xy

    Plots legend 'string' for line with attribute 'attr'
    If given, two-digits integer 'xy' moves starting point of legend
    from left-upper corner to {(1+x)*X_shift, (1+y)*Y_shift},
    where X_shift, Y_shift - some default values

    subroutine OpenDialogBox()

    Opens text-dialog window with descriptor DW (see above)
    WARNING: any output to dialog box suppress output to current graphic window
    (known bug to be fix)

    subroutine plot(x,y,attr)
    real(8), dimension(:) :: x
    real(8), dimension(:), optional :: y
    character*(*), optional :: attr

    plots is MATLAB-style callable routine for plane graphics
    Only the following functionality of MATLAB's plot is supported
    plot(x,y) plots vector y versus vector x
    plot(y) plots the columns of y versus their index
    Various line types, plot symbols and colors may be obtained with plot(x,y,attr) where attr is a character string made from one element from any or all the following 3 columns:
    y yellow . point _ solid
    m magenta o circle : dotted
    c cyan x x-mark ; dash-dot
    r red + plus - dashed
    g green * asterisk h histogram
    b blue    
    w white    
    k black    
    For example, plot(x,y,'c+:') plots a cyan dotted line with a plus at each data point; plot(x,y,'b*') plots blue asterisk at each data point but does not draw any line

    subroutine title(string)
    character*(*) string

    Print title "string"

    subroutine xlabel(string)
    character*(*) string

    Print X-caption "string"

    subroutine ylabel(string)
    character*(*) string

    Print Y-caption "string"

    subroutine Wait()

    Wait for user input into dialog window

    subroutine whitebg()

    Consequent calls of this routine
    toggle background color from black to white and vice versa


    subroutine draw_ticks(x1,x2,y1,y2)
    subroutine draw_axis(x1,x2,y1,y2)
    integer(4) function limits_w(x1,y1,x2,y2)
    function plot_mode(attr)
    integer(4) function select_color(clr)
    subroutine set_limits(xx,yy,x1,x2,y1,y2)
    subroutine string_position(string,orient)
    subroutine style_draw(j,n,xx,yy,ifstyle,attr)