67
How to build a vertical filled plot in IDL
IDL includes a routine called FILLPLOT which allows to create horizontal filled plots. However it does not support vertical filled plots:
https://www.nv5geospatialsoftware.com/docs/FILLPLOT.html
The easiest way to build vertical filled plots is then to use the POLYGON routine instead:
https://www.nv5geospatialsoftware.com/docs/POLYGON.html
The code example below is showing how to use POLYGON routine to build a vertical filled PLOT
PRO TEST_VERTICAL_FILLED_PLOT
; create X data as Mineral %
x=[1,5,2,3,4,5,6,6,2,0,0,0,2,3,4,5,4,3,1,2]
; create Y data as Depth
y=INDGEN(20)
; retrieve X and Y minimum and maximum values
xpmin=min(x)
xpmax=max(x)
ypmin=min(y)
ypmax=max(y)
; dsiplay data, with increasing depth from top to bottom of Y axis
g = PLOT(x, y, YTITLE='Depth',XRANGE=[xpmin,xpmax],YRANGE=[ypmax,ypmin])
g['axis0'].SHOWTEXT =0
g['axis2']. TITLE='Mineral %'
g['axis2'].SHOWTEXT =1
; build the polygon by adding the points:
; [ xpmin, ypmax] , [ xpmin, ypmin] and [ x[0], y[0]] to the input data to close the polygon along the vertical Y axis
xExt = [ x, xpmin, xpmin, x[0]]
yExt = [ y, ypmax, ypmin, y[0]]
; draw the polygon
pol = POLYGON(xExt, yExt, /DATA, FILL_BACKGROUND=1, FILL_COLOR='Yellow',TARGET=g2)
END
A graphic similar to the following will be generated:

---------------------------------------
created by BC on 2/19/2025
reviewed by BC (US) on 2/19/2025