如何在 IDL 中构建垂直填充图
IDL包含一个名为FILLPLOT的例程,可用于创建水平填充图,但不支持垂直填充图。构建垂直填充图的最简便方法是改用POLYGON例程。以下代码示例展示了如何使用POLYGON例程构建垂直填充图。
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
将生成类似于以下内容的图形:


浙公网安备 33010602011771号