“IDL8”的版本间差异
跳到导航
跳到搜索
(未显示同一用户的31个中间版本) | |||
第1行: | 第1行: | ||
==new features== |
|||
'''相对于IDL7.1的IDL8系列的新功能''' |
|||
===画图=== |
|||
==函数== |
|||
*errorplot |
|||
*idl_convert (单位转换,很实用),参见IDLUNIT() |
|||
:完整的误差棒程序 |
|||
*barplot |
|||
==变量== |
|||
*变量的运算 [http://www.harrisgeospatial.com/docs/whats_new_8_4.html] |
|||
var = RANDOMU(seed, 200, 100) |
|||
PRINT, var.length |
|||
PRINT, var.ndim |
|||
PRINT, var.dim |
|||
PRINT, var.typecode |
|||
PRINT, var.typename |
|||
PRINT, var1.Mean() |
|||
PRINT, var1.Total() |
|||
var2 = var1.Sort() |
|||
*biginteger |
|||
:任意位数的整数 |
|||
===系统变量=== |
|||
*!const |
|||
:常用物理常数 |
|||
==函数== |
|||
*FOLDERWATCH |
|||
:监控文件夹 |
|||
* CODE_COVERAGE |
|||
:监控那些CODE被执行 (选择判断) |
|||
*FFT Power Spectrum |
|||
==画图== |
|||
===IDL graphics=== |
|||
新的图形系统相比于之前的Direct Graphics系统的差别是可以动态的调整图形元素 |
|||
*P1.window.setcurrent ; 将某个图形窗口设为当前窗口 |
|||
*把某个已经存在的图形窗口作为当前窗口画图 |
|||
win=getwindows() |
|||
if N_elements(win) gt 0 then begin |
|||
win[0].setcurrent |
|||
win[0].erase |
|||
endif |
|||
或者 |
|||
a=plot(indgen(10),window_title='P1') |
|||
win=getwindows('P1') |
|||
win.setcurrent |
|||
====plot函数==== |
|||
[[IDL8中的plot函数]] |
|||
====legend==== |
|||
a = findgen(11) |
|||
b = 20./(a+1)^2 |
|||
p1 = PLOT(a, b, '4', /HISTOGRAM, NAME='Theoretical', /YLOG, YRANGE=[0.01,100]) |
|||
p2 = PLOT(RANDOMU(-1, 11), '4r', NAME='Experimental', TRANSPARENCY=50, /HISTOGRAM, /OVERPLOT) |
|||
h = LEGEND(POSITION=[9,50],label=['haha','papa'] /DATA) |
|||
P3=plot(/test,/overplot) |
|||
h1.add,p3 ;自动增加一个标题,不能是数组 |
|||
====text函数 ==== |
|||
*和原来的xyouts对应, 直接支持latex符号 |
|||
* 注意,在多个panel的图上,使用/data定位的时候,要用target关键词制定图形对象 |
|||
fn = exp(SIN(FINDGEN(100))^FINDGEN(100)) |
|||
p1 = PLOT(fn, LAYOUT = [1, 2, 1], /CURRENT, TITLE = '1') |
|||
p2 = PLOT(fn, LAYOUT = [2, 2, 3], xrange=[25, 42], /CURRENT, TITLE = '2') |
|||
t=text(30,2.5,'test1',/data,target=P1) |
|||
t=text(30,2.5,'text2',/data,target=P2) |
|||
====errorplot==== |
|||
完整的误差棒程序 |
|||
====barplot==== |
|||
:棒状图 |
:棒状图 |
||
*polarplot |
|||
====boxplot==== |
|||
====polarplot==== |
|||
:极坐标 |
:极坐标 |
||
*vector |
|||
====vector==== |
|||
:画矢量图(箭头) |
:画矢量图(箭头) |
||
*streamline |
|||
====symbol==== |
|||
*画多个panel的时候可以用layout关键词 |
|||
:画符号,支持latex |
|||
====colorbar==== |
|||
:画颜色棒 |
|||
cb=colorbar(rgb_table-4,ticklen=0,range=[0,20],position=[0.15, 0.88, 0.45, 0.93],title='R/Re') |
|||
====axes==== |
|||
*AXES可以直接在image上画坐标轴 |
|||
===image=== |
|||
*函数 |
|||
:RGB_VALUE : 选择color bar |
|||
:max:可以用最大值归一化 |
|||
:axis: 图像是否显示坐标轴 |
|||
:p.axes 可定制 |
|||
p=image(Agez,position=[0.15,0.1,0.9,0.5],max=max(Agez),RGB='rainbow',axis=1,$ |
|||
xtitle='Age (Gy)',ytitle='$Z/Z_\odot$',/current) |
|||
ax=p.axes |
|||
ax[0].tickvalues=[0,2,4,7,9,11,13,15,17,19] |
|||
ax[0].tickname=['0.001','0.01','0.1','1','3','5','7','9','11','13'] |
|||
ax[1].tickname=['0.005','0.002','0.02','0.04','1','2.5'] |
|||
===地图相关=== |
|||
*map (可以投影天球) |
|||
mymap = MAP('hammer', FILL_COLOR="light_blue") |
|||
; Convert from longitude/latitude to meters |
|||
longitudes = [-83.02, 88.50] |
|||
latitudes = [42.42, 47.17] |
|||
xy = mymap.MapForward(longitudes, latitudes) |
|||
; Convert back to longitude/latitude and plot |
|||
EXPAND, xy, 2, 20, xycoordinates |
|||
lonlat = mymap.MapInverse(xycoordinates) |
|||
p = PLOT(lonlat[0,*], lonlat[1,*], 'rS', /OVERPLOT, /SYM_FILLED) |
|||
==数组运算== |
|||
*array_equal |
*array_equal |
2017年3月31日 (五) 06:01的最新版本
相对于IDL7.1的IDL8系列的新功能
函数
- idl_convert (单位转换,很实用),参见IDLUNIT()
变量
- 变量的运算 [1]
var = RANDOMU(seed, 200, 100) PRINT, var.length PRINT, var.ndim PRINT, var.dim PRINT, var.typecode PRINT, var.typename PRINT, var1.Mean() PRINT, var1.Total() var2 = var1.Sort()
- biginteger
- 任意位数的整数
系统变量
- !const
- 常用物理常数
函数
- FOLDERWATCH
- 监控文件夹
- CODE_COVERAGE
- 监控那些CODE被执行 (选择判断)
- FFT Power Spectrum
画图
IDL graphics
新的图形系统相比于之前的Direct Graphics系统的差别是可以动态的调整图形元素
- P1.window.setcurrent ; 将某个图形窗口设为当前窗口
- 把某个已经存在的图形窗口作为当前窗口画图
win=getwindows() if N_elements(win) gt 0 then begin win[0].setcurrent win[0].erase endif
或者
a=plot(indgen(10),window_title='P1') win=getwindows('P1') win.setcurrent
plot函数
legend
a = findgen(11) b = 20./(a+1)^2 p1 = PLOT(a, b, '4', /HISTOGRAM, NAME='Theoretical', /YLOG, YRANGE=[0.01,100]) p2 = PLOT(RANDOMU(-1, 11), '4r', NAME='Experimental', TRANSPARENCY=50, /HISTOGRAM, /OVERPLOT) h = LEGEND(POSITION=[9,50],label=['haha','papa'] /DATA) P3=plot(/test,/overplot) h1.add,p3 ;自动增加一个标题,不能是数组
text函数
- 和原来的xyouts对应, 直接支持latex符号
- 注意,在多个panel的图上,使用/data定位的时候,要用target关键词制定图形对象
fn = exp(SIN(FINDGEN(100))^FINDGEN(100)) p1 = PLOT(fn, LAYOUT = [1, 2, 1], /CURRENT, TITLE = '1') p2 = PLOT(fn, LAYOUT = [2, 2, 3], xrange=[25, 42], /CURRENT, TITLE = '2') t=text(30,2.5,'test1',/data,target=P1) t=text(30,2.5,'text2',/data,target=P2)
errorplot
完整的误差棒程序
barplot
- 棒状图
boxplot
polarplot
- 极坐标
vector
- 画矢量图(箭头)
symbol
- 画符号,支持latex
colorbar
- 画颜色棒
cb=colorbar(rgb_table-4,ticklen=0,range=[0,20],position=[0.15, 0.88, 0.45, 0.93],title='R/Re')
axes
- AXES可以直接在image上画坐标轴
image
- 函数
- RGB_VALUE : 选择color bar
- max:可以用最大值归一化
- axis: 图像是否显示坐标轴
- p.axes 可定制
p=image(Agez,position=[0.15,0.1,0.9,0.5],max=max(Agez),RGB='rainbow',axis=1,$ xtitle='Age (Gy)',ytitle='$Z/Z_\odot$',/current) ax=p.axes ax[0].tickvalues=[0,2,4,7,9,11,13,15,17,19] ax[0].tickname=['0.001','0.01','0.1','1','3','5','7','9','11','13'] ax[1].tickname=['0.005','0.002','0.02','0.04','1','2.5']
地图相关
- map (可以投影天球)
mymap = MAP('hammer', FILL_COLOR="light_blue") ; Convert from longitude/latitude to meters longitudes = [-83.02, 88.50] latitudes = [42.42, 47.17] xy = mymap.MapForward(longitudes, latitudes) ; Convert back to longitude/latitude and plot EXPAND, xy, 2, 20, xycoordinates lonlat = mymap.MapInverse(xycoordinates) p = PLOT(lonlat[0,*], lonlat[1,*], 'rS', /OVERPLOT, /SYM_FILLED)
数组运算
- array_equal