GLE Library: barstyles.gle

! Subroutines to draw customized bar plots

bar_colormap_pixels = 200
bar_gridline_width = 0.01

sub bar_colormap x1 y1 x2 y2 b g
   amove x1 y1
   begin clip
      begin path clip
          box x2-x1 y2-y1
      end path
      colormap y 0 1 0 1 1 bar_colormap_pixels x2-x1 yg(ygmax)-yg(ygmin) color
   end clip
   box x2-x1 y2-y1 fill clear
end sub

sub bar_colormap_palette_labels x1 y1 x2 y2 value palette$ fmt$
  if value >= 0 then
    y1 = y1 + bar_gridline_width
    y2 = y2 + bar_gridline_width
  else
    y1 = y1 - bar_gridline_width
    y2 = y2 - bar_gridline_width
  end if
  amove x1 y1
  colormap y 0 1 0 1 1 bar_colormap_pixels x2-x1 y2-y1 palette palette$
  ! draw data labels
  gsave
  set just bc hei 0.23
  if value < 0 then y2 = yg(0)
  amove (x1+x2)/2 y2+0.1
  write format$(value, fmt$)
  grestore
end sub

 

[Return to subroutines page]