绘图颜色转换
;直接图形法plot黑底白形,用于颜色反转,在plot前运行
pro rc
oribkcolor = !p.background
!p.background = !p.color
!p.color = oribkcolor
end
PLOT
IDL> window,1,xsize = 800,ysize = 500
IDL> xdata = findgen(200)/10
IDL> rc
% Compiled module: RC.
IDL> rc
IDL> rc
plot,xdata,sin(xdata),title = '正弦曲线',xtitle = 'x axis',ytitle = 'sin(x)'
IDL> SDF,1,'fig1.png',800,500
IDL> window,1
IDL> !p.title = 'kx'
IDL> !x.title = 'x'
IDL> !y.title = 'y'
IDL> !x.range = [1,5]
IDL> !x.style = 8
IDL> plot,indgen(10)
;创建大小为800*600像素的窗口
window,0,xsize = 800, ysize = 600
;设置多行显示,2行2列
!p.multi = [0,2,2]
data = findgen(20)
plot,data
plot,sin(data/3),cos(data/6)
plot,data,data,/polar,title = 'polar'
plot,sin(data/10),psym = 4,xtitle = 'x',ytitle = 'y'
;恢复多图控制参数
!p.multi = 0
end
IDL> window,0,xsize = 800,ysize = 600
IDL> !p.background = !p.color
IDL> !p.color = 0
IDL> !p.multi=[0,2,2]
IDL> xdata = findgen(20)/4
IDL> ydata = sin(xdata)
IDL> plot,xdata,ydata
IDL> plot,xdata,ydata,psym = 3
IDL> plot,xdata,ydata,psym = 4
IDL> plot,xdata,ydata,psym = 10
bar_PLOT
Contour
IDL> window,0,xsize = 800,ysize = 600
IDL> !p.multi=[0,2,2]
IDL> data = Dist(200)
IDL> contour,data
IDL> contour,data,nlevels = 10,/follow
IDL>
IDL> a = randomu(seed,5,6)
IDL> b = min_curve_surf(a)
% Compiled module: MIN_CURVE_SURF.
IDL> contour,b,nlevels = 5,/downhill
IDL> tek_color
% Compiled module: TEK_COLOR.
IDL> surface,data
函数列表
Bar_Plot |
绘制柱形图 |
Contour |
绘制等值线 |
Device |
系统的设备参数 |
ErrPlot |
绘制误差柱形图 |
Flow3 |
绘制3D流线图 |
Image_Cont |
图像叠加等值线 |
Map_Horizon |
绘制水平线 |
Bar_Plot |
绘制柱形图 |
OPlot |
在已有窗口中叠加曲线 |
OPlotErr |
叠加绘制误差柱形图 |
PLOT |
曲线绘制 |
Plot_3DBox |
绘制三维空间下的两个变量 |
Plot_Field |
绘制2D箭头 |
PlotErr |
基于误差绘制独立点 |
Plots |
叠加绘制图形,dims must be (2,n) or (3,n) |
Polar_Contour |
极坐标下绘制等值线 |
Surface |
绘制二维曲面 |
Threed |
二维数组假定为三维曲面 |
TV |
绘制图像 |
TVRD |
对当前显示窗体进行拍照 |
Vel |
绘制风场箭头(长度基于强度) |
Velovect |
绘制风场 |
Window |
创建特定索引显示窗口 |
Wset |
设置当前显示窗口 |
Zoom |
部分放大显示 |
MULTI
!P.MULTI allows making multiple plots on a page or screen. It is a 5-element integer array defined as follows:
!P.MULTI[0] contains the number of plots remaining on the page.
If !P.MULTI[0] is less than or equal to 0, the page is cleared, the next plot is placed in the upper left hand corner,
and !P.MULTI[0] is reset to the number of plots per page.
Setting !P.MULTI[0] to a value greater than zero can be used to manually set the plotting area to a specific row and column.
For example, to plot in the lower left corner of a window of two rows and two columns, set !P.MULTI as follows:
!P.MULTI=[2,2,2]
PLOT, X, Y
!P.MULTI[1] is the number of plot columns per page. If this value is less than or equal to 0, one is assumed.
If more than two plots are ganged in either the X or Y direction, the character size is halved.
!P.MULTI[2] is the number of rows of plots per page. If this value is less than or equal to 0, one is assumed.
!P.MULTI[3] contains the number of plots stacked in the Z dimension.
!P.MULTI[4] is 0 to make plots from left to right (column major), and top to bottom,
and is 1 to make plots from top to bottom, left to right (row major).
Note: If !P.MULTI[0] is zero, an erase will occur before the current plot is displayed (unless the /NOERASE keyword is set).
This is true no matter whether !P.POSITION and/or !P.REGION are set.
For example, to gang two plots across the page:
!P.MULTI = [0, 2, 0, 0, 0]
PLOT, X0, Y0 ;Make left plot.
PLOT, X1, Y1 ;Right plot.
To gang two plots vertically:
!P.MULTI = [0, 0, 2, 0, 0]
PLOT, X0, Y0 ;Make top plot.
PLOT, X1, Y1 ;Bottom plot.
To make four plots per page, two across and two up and down:
!P.MULTI = [0, 2, 2, 0, 0]
and then call plot four times.
To reset !P.MULTI back to the normal one plot per page:
!P.MULTI = 0
See Multiple Plots on a Page for additional examples.
See Specifying the Location of the Plot for information on how !P.MULTI relates to plot location.
The following system variables control various IDL Direct Graphics functions.
These system variables are structures that contain many tags. For example, the command
!P.TITLE = 'Cross Section'
sets the default plot title.
Many of the functions of the graphics keywords described in Direct Graphics Keywords
are also controlled by the system variables !P, !X, !Y, and !Z.
You can change the default style of plots, fonts, etc.,
by setting the corresponding field in the appropriate system variable.
Also, some effects that persist longer than one call are controlled only by system variables.
Graphic Keywords List
The following graphics keywords are discussed in this page:
BACKGROUND: !P.BACKGROUND.
For example, to produce a black plot with a white background on an indexed-color display:
PLOT, Y, BACKGROUND = 255, COLOR = 0
CHARSIZE: !P.CHARSIZE.
The overall character size for the annotation when Hershey fonts are selected.
This keyword does not apply when hardware (i.e. PostScript) fonts are selected.
A CHARSIZE of 1.0 is normal. The size of the annotation on the axes may be set,
relative to CHARSIZE, with xCHARSIZE, where x is X, Y, or Z.
The main title is written with a character size of 1.25 times this parameter.
COLOR: !P.COLOR.
Set this keyword to specify the color index of the data, text, line, or solid polygon fill to be drawn.
If this keyword is omitted, !P.COLOR specifies the color index.
LINESTYLE: !P.LINESTYLE.
This keyword indicates the line style used to draw lines;
it indicates the line style of the lines used to connect the data points.
This keyword should be set to the appropriate index for the desired linestyle as described in the following table.
0 solid
1 dotted
2 dashed
3 dash dot
4 dash dot dot
5 long dashes
PSYM: !P.PSYM.
from 1 to 10
Histogram Mode:
; Two-hundred values ranging from -5 to 4.95:
X = FINDGEN(200) / 20. - 5.
; Theoretical normal distribution, scale so integral is one:
Y = 1/SQRT(2.*!PI) * EXP(-X^2/2) * (10./200)
; Approximate normal distribution with RANDOMN,
; then form the histogram.
H = HISTOGRAM(RANDOMN(SEED, 2000), $
BINSIZE = 0.4, MIN = -5., MAX = 5.)/2000.
; Plot the approximation using "histogram mode."
PLOT,FINDGEN(26) * 0.4 - 4.8, H, PSYM = 10
; Overplot the actual distribution:
OPLOT, X, Y * 8.
SUBTITLE: !P.SUBTITLE.
A text string to be used as a subtitle for the plot. Subtitles appear below the X axis.
TITLE: !P.TITLE.
Produces a main title centered above the plot window.
The text size of this main title is larger than the other text by a factor of 1.25. For example:
PLOT, X, Y, TITLE = 'Final Results'
[XYZ]RANGE: ![XYZ].RANGE.
The desired data range of the axis, a 2-element vector.
The first element is the axis minimum, and the second is the maximum.
IDL will frequently round this range. This override can be defeated using the [XYZ]STYLE keywords.
[XYZ]TICK_GET:
A named variable in which to return the values of the tick marks for the designated axis.
The result is a double precision floating-point array with the same number of elements as ticks.
For example, to retrieve in the variable V the values of the tick marks selected by IDL for the Y axis:
PLOT, X, Y, YTICK_GET = V
[XYZ]TITLE: ![XYZ].TITLE.
A string that contains a title for the specified axis.
ZVALUE:
Sets the Z coordinate, in normalized coordinates in the range of 0 to 1, of the axis and data output from PLOT, OPLOT, and CONTOUR.
This keyword has effect only if !P.T3D is set and the three-dimensional to two- dimensional transformation is stored in !P.T.
If ZVALUE is not specified, CONTOUR will output each contour at its Z coordinate, and the axes and title at a Z coordinate of 0.0.