Coyote库

来自Shiyin's note
Shen讨论 | 贡献2015年10月10日 (六) 02:53的版本 →‎cgps_open,cgps_close
跳到导航 跳到搜索

数组运算

setintersection,setunion,setdifference

  ;   a = [2,4,6,8]
  ;   b = [6,1,3,2]
  ; SetIntersection(a,b) = [ 2, 6]       ; Common elements
  ; SetUnion(a,b) = [ 1, 2, 3, 4, 6, 8]  ; Elements in either set
  ; SetDifference(a,b) = [ 4, 8]         ; Elements in A but not in B
  ; SetIntersection(a,[3,5,7]) = -1      ; Null Set

画图

cgimage

显示图像程序

/axes: 显示坐标轴,并且可用Xrange和Yrange来控制,同时显示xtitle,ytitle,title等设置 除了常用的关键词外,其它axes命令的关键词可以用axkeywords的方法进行关键词继承

cgimage,ima,xtitle='x',ytitle='y'/axes,axkewwords={xticks=3,yticks=3}

margin=0,可以用在显示多幅图像,结合!P.multi使用

multimargin=[left,top,right,bottom] 可以更灵活的控制

position=[x0,y0,x1,y1] :图像显示的位置

/scale: scale 图像值到颜色表

cgcolor

直接生成颜色的数值

例:plot,indgen(10),color=cgcolor('red')

cgcolorbar

显示颜色表,

range=[min,max]控制范围

position=[x0,y0,x1,y1] :控制位置

/vertical 显示竖直方向的颜色表,默认是水平的


cgcContour

/fill 用颜色填充

/overplot 可以overplot在前面的plot之上

/onimage 显示在之前的图上面


cgps_open,cgps_close

旧版本中,这两个程序是:ps_start,ps_end

cgplot

可完全替代plot,可默认使用字符串表示的简单颜色;

例cgplot,indgen(10),color='red'

/overplot标签,继续plot,相当于plots 还有一个cgplots,类似于plots

Keywords

  • psym: in, optional, type=integer

Any normal IDL PSYM values, plus any value supported by the Coyote Library routine SYMCAT. An integer between 0 and 46.

  • symcolor: in, optional, type=string/integer, default='black'

If this keyword is a string, the name of the symbol color. By default, 'black'. Otherwise, the keyword is assumed to be a color index into the current color table.

  • symsize: in, optional, type=float, default=1.0

The symbol size.

  • color 可以调用颜色表loadct之后,color=数字(0-255)经过测试这个数字一定需要简单整数
loadct,13
cgplot,indgen(10),color=40
cgplot,indgen(10),color=40L

结果是不一样的

cgwindow

生成一个新的图形窗口,可调整大小,有菜单可导出成任何格式文件。 在cgplot等命令中,加上关键字/window 则可保证画图在cgwindow产生的窗口中


cgtext

替代xyouts。 关键词Alignment,设置0,0.5,1 ,分别表示左,中,又对齐

  • 例1,在屏幕的固定比例上显示字符,与图形的frame无关
IDL> cgText, 0.5, 0.5, 'This is sample text', ALIGNMENT=0.5, /NORMAL
  • 例2,用鼠标选取显示字符的地方
IDL> cgText, /PLACE, 'Use the cursor to locate this text', COLOR='dodger blue'

cghistoplot

直方图

  • 注:astro_lib的最新版已经完全基于最新的Coyote库