-
Notifications
You must be signed in to change notification settings - Fork 46
plot
Fabian Kindermann edited this page Apr 1, 2021
·
2 revisions
subroutine plot(xin, yin, color, linewidth, marker, markersize, noline, legend)
Our toolbox provides a set of routines that can be used for plotting graphs directly out of your Fortran program. The plotting process for 2D-graphs thereby consists of two steps. The subroutines plot and plot_hist allow to add plotdata (i.e. lines, dots and histograms) to your plots (almost as many as you want). After you’ve added all the necessary data to your plot, you can start the plotting process by means of the subroutine execplot, which will transfer your plot data to the program GNUplot and start this program, so that your graphs will be displayed in a pop-up window.
The subroutine plot
add as line made of the x-y-data-pairs xi
and yi
to your plot. It also contains a couple of optional plot formatting inputs.
-
real*8 :: xin(:)
This is a one-dimensional array of arbitrary length that contains the x-data for plotting. -
real*8 :: yin(:)
This is a one-dimensional array that contains the y-data for plotting. This array needs to have exactly the same length as the arrayxin
. Otherwise the subroutine throws an error message.
-
character(LEN=*) :: color
Thischaracter
argument allows to specify the color of the line that should be drawn. You can use both literal color names like'blue'
or'red'
or hexadecimal color codes like'#0000FF'
for blue or'#FF0000'
for red. The internet offers multiple sources that allow you to determine the hexadecimal codes of colors. For further information about colors in GNUplot, you can look at its documentation. If no color value is specified, then the plotting routine will give each line a different color according to a predetermined color scheme. -
real*8 :: linewidth
This variable specifies the width of the line that should be drawn. The default linewidth is equal to2d0
. -
integer :: marker
This variable specifies whether a marker should be placed on each x-y-data-pair and how this marker should look like. If this argument is not present when the subroutineplot
is called, then no marker will be placed. If this argument is present in your subroutine call, then you can choose among 13 different markers. Just try out for yourself how they look like. Note that when thenolines
option is set to.true.
, then markers are placed automatically on this plot. -
real*8 :: markersize
This variable specifies the size of the markers set on each x-y-data-pair. The default markersize is equal to1d0
. -
logical :: noline
If this logical variable is present and set to a value of.true.
, then there will be no connecting line between the x-y-data-pairs supplied inxi
andyi
. Instead, the subroutine will only draw markers for each x-y-data-pair. -
character(LEN=*) :: legend
Through this character variable of arbitrary length, you can supply a legend entry for the respective line you want to plot.
- For further reading refer to:
- This routine is used in the following programs:
prog01_17.f90
prog02_15.f90
prog02_16.f90
prog02_17.f90
prog02_18.f90
prog04_01.f90
prog04_04.f90
prog04_05.f90
prog04_08.f90
prog04_09.f90
prog08_01.f90
prog08_02.f90
prog08_03.f90
prog08_04.f90
prog08_05.f90
prog08_06.f90
prog08_07.f90
prog09_01.f90
prog09_02.f90
prog09_03.f90
prog09_04.f90
prog09_09.f90
prog09_10.f90
prog10_01.f90
prog10_02.f90
prog10_03.f90
prog10_04.f90
prog10_05.f90
prog10_06.f90