IDL8中的plot函数
跳到导航
跳到搜索
基本图形
p = PLOT(data, '-r2+')
;Tokens in the Format string represent values of the LINESTYLE, COLOR, THICK, and SYMBOL properties.
- linestyle
0, '-',solid 1,':',dotted 2,'--',dashed 3,'-.',dash_dot
- axes
p = PLOT(/TEST) ax = p.AXES ax[0].TITLE = 'X axis' ax[1].TITLE = 'Y axis' ax[2].HIDE = 1 ; hide top X axis ax[3].HIDE = 1 ; hide right Y axis ax[0].showtext=0 ;隐藏坐标上的数字和title,画紧凑直方图很有用
多个panel
- 画多个panel的时候可以用layout关键词,而且可以动态调整
fn = exp(SIN(FINDGEN(100))^FINDGEN(100)) w1 = WINDOW() p1 = PLOT(fn, LAYOUT = [1, 2, 1], /CURRENT, TITLE = '1') p2 = PLOT(fn, LAYOUT = [2, 2, 3], xrange=[25, 42], /CURRENT, TITLE = '2') p3 = PLOT(fn, LAYOUT = [2, 2, 4], xrange=[50, 60], /CURRENT, TITLE = '3')
- colorbar 用法更自由,target关键词,不需要自己设计
图形操作
- 选择图形
P1=plot(/test,layout=[1,2,1]) P2=plot(/test,layout=[1,2,2],/current) P1.select
- 删除图形元素
- P2.delete
- 生成图形的code [1]
- p.GenerateCode, 'mycode.pro'
- save
- 可以直接把图保存成文件
p = OBJARR(3) ; Create three plots with random data FOR i = 0, 2 DO BEGIN t = 0.1*FINDGEN(50) y = SMOOTH(RANDOMU(seed,50), 5) p[i] = PLOT(t,y,'b', SYMBOL='D', TITLE='Observation'+STRING(i+1)) ENDFOR ; Build the multi-page PDF file, one page at a time p[0].Save, 'data1.pdf', /APPEND p[1].Save, 'data1.pdf', /APPEND p[2].Save, 'data1.pdf', /APPEND, /CLOSE