plot_hist (manual creation) - fabiankindermann/ce-fortran GitHub Wiki

subroutine plot_hist(xin, yin, color, legend)

Description:

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_hist with manual plot creation adds as histogram to your plot. The histogram needs to manually be created by the user. The subroutine takes the centers of the histogram bins as well as the bin heights as input data.

Input arguments:

  • real*8 :: xin(:)
    This is a one-dimensional array of arbitrary length that defines the centers of the histogram bins.
  • real*8 :: yin(:)
    This is a one-dimensional array that defines the hights of the different histogram bins. This array needs to have exactly the same length as the array xin. Otherwise the subroutine throws an error message.

Optional arguments:

  • character(LEN=*) :: color
    This character 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.
  • character(LEN=*) :: legend
    Through this character variable of arbitrary length, you can supply a legend entry for the respective line you want to plot.

References

⚠️ **GitHub.com Fallback** ⚠️