Histogram example

The script below illustrates how to fill the area under a histogram profile and how to fill the bars of a histogram with different colors.

Note that the main script calls another script to do a repetitive task.

X = [1.1:1.6:0.1]
Y = [2.2;2.4;2.6;3.1;4.5;5.1]
WINDOW 5
@sub
SET HISTOGRAMTYPE 1
SET AREAFILLCOLOR RED
GRAPH X Y
TEXT 'histogramtype = 1'
WINDOW 6
@sub
SET HISTOGRAMTYPE 2
SET AREAFILLCOLOR [-1:-6:-1]
GRAPH X Y
TEXT 'histogramtype = 2'
WINDOW 7
@sub
SET HISTOGRAMTYPE 3
SET AREAFILLCOLOR blue
GRAPH X Y
TEXT 'histogramtype = 3'
WINDOW 8
@sub
SET HISTOGRAMTYPE 4
SET AREAFILLCOLOR [-7:-12:-1]
GRAPH X Y
TEXT 'histogramtype = 4'

The auxiliary script, sub.pcm, is shown here.

  ! sub.pcm
  !
  DEFAULTS
  SET %XNUMBERHEIGHT 4
  SET %YNUMBERHEIGHT 4
  SET %XIMAGTICLENGTH 2
  SET %XTEXTLOCATION 50
  SET %YTEXTLOCATION 90
  SET TEXTINTERACTIVE 0
  SET TEXTALIGN 2
  SET %TEXTHEIGHT 5

  Curve example
  Area between two curves example