Skip to content

Shahid718/7-Fortran-plots

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

7 Quick plots in Fortran

The repository demonstrates the use of 7 Quick plots. The example code is the Cahn-Hilliard type phase field model.

Prerequisites

Quick plot routines

are one statement data plotting DISLIN routines.

Plot routines Description
qplot ( X-array, Y-array, N ) plots data points with line
qplsca ( X-array, Y-array, N ) plots data points with symbol
qplclr ( Z, Nx, Ny ) color plot of a matrix
qplcon ( Z, Nx, Ny, Level ) contour plot of a matrix
qplsur ( Z, Nx, Ny ) surface plot of a matrix
qplbar ( Y-array, N) plots a bar graph
qplpie ( Y-array, N) plots a pie chart

X-array and Y-array are arrays with X and Y coordinates.

N is number of data points.

Z is a matrix with dimension (Nx,Ny).

Nx, Ny are the dimensions of Z.

Level is a number of contour levels to be generated.

Y-array is array of data points.

Compile and run

The command for single precision is

f90link -a main

For double precision

f90link -a -r8 main

where main is the name of file main.f90

Computing platform

The example codes are tested for

OS Compiler version
Windows 10 gfortran 13.2.0

Output

The default output is the console.

  1. qplot (X-array, Y-array, N )

qplot

  1. qplsca (X-array, Y-array, N )

qplsca

  1. qplclr ( Z, Nx, Ny )

qplclr

  1. qplcon ( Z, Nx, Ny, Level )

qplcon

  1. qplsur ( Z, Nx, Ny )

qplsur

  1. qplbar ( Y-array, N)

qplbar

  1. qplpie ( Y-array, N)

qplpie

Modified quick plots

The second code main_1.f90 shows the use of routines to change the default output format. They also add axis labels and the title of the plot. Note that they should be used for each quick plot.

  call METAFL ('png')
  call SCRMOD ('revers')
  call DISINI
  call NAME ('c', 'X')
  call NAME ('F', 'Y')
  call TITLIN ('Free Energy', 2) 

The above routines save the plot in png format and change the background to white. The file name is dislin.png by default. The next file will have dislin_1.png and so on. The outputs are:

  1. qplot (X-array, Y-array, N )

qplot

  1. qplsca (X-array, Y-array, N )

qplsca

  1. qplclr ( Z, Nx, Ny )

qplclr

  1. qplcon ( Z, Nx, Ny, Level )

qplcon

  1. qplsur ( Z, Nx, Ny )

qplsur

  1. qplbar ( Y-array, N)

qplbar

  1. qplpie ( Y-array, N)

qplpie


Date : 7 October 2023

About

The repository shows the usage of 7 DISLIN routines for data plotting. They are single statement routines.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published