“Coyote库”的版本间差异

来自Shiyin's note
跳到导航 跳到搜索
 
(未显示3个用户的12个中间版本)
第1行: 第1行:
==数组运算==
===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 ===


== cgimage ==


显示图像程序
显示图像程序
第16行: 第25行:
/scale: scale 图像值到颜色表
/scale: scale 图像值到颜色表


== cgcolor ==
=== cgcolor ===
直接生成颜色的数值
直接生成颜色的数值
例:plot,indgen(10),color=cgcolor('red')
例:plot,indgen(10),color=cgcolor('red')


== cgcolorbar ==
=== cgcolorbar ===


显示颜色表,
显示颜色表,
第31行: 第40行:




== cgcContour ==
=== cgcContour ===


/fill 用颜色填充
/fill 用颜色填充
第40行: 第49行:




===cgps_open,cgps_close===
== ps_start,ps_end ==
旧版本中,这两个程序是:[[ps_start,ps_end]]


*可以使用/encapsulated开关生成eps图
可以替代psopen,psclose
*用cgPS_Close, /PNG,可同时多生成一个同名的png图


*似乎在nomatch下,和一些关键词不兼容,cgplot甚至不如plot
生成的ps图和显示图完全一致;默认的是LETTER,单位inch,支持彩色;


=== cgplot ===
字体的粗细默认数值用关键字default_thickness控制,似乎等于4效果更好,原来默认数值是3.
支持PS文件的设置参数:keywords = PSConfig()

可定制XSIZE,YSIZE等参数

/Metric 选项,使用公制,就默认是A4 paper,单位cm

*默认的ps图形容是按照显示器的大小来的,所以是landscape的。
*要改成portrait,一是打开/nomatch的开关,二是用Default Setup = "System (Portrait)"

== cgplot ==


可完全替代plot,可默认使用字符串表示的简单颜色;
可完全替代plot,可默认使用字符串表示的简单颜色;
第64行: 第65行:
还有一个cgplots,类似于plots
还有一个cgplots,类似于plots


===Keywords===
psym: in, optional, type=integer
*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.
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'
*symcolor: in, optional, type=string/integer, default='black'
If this keyword is a string, the name of the symbol color. By 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.
Otherwise, the keyword is assumed to be a color index into the current color table.


symsize: in, optional, type=float, default=1.0
*symsize: in, optional, type=float, default=1.0
The symbol size.
The symbol size.


*color 可以调用颜色表loadct之后,color=数字(0-255)'''经过测试这个数字一定需要简单整数'''
== cgwindow ==
loadct,13
cgplot,indgen(10),color=40
cgplot,indgen(10),color=40L
结果是不一样的

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


*如何指定 window/cgwindow
:在原生IDL里面,用window,n ; wset n来制定window
:cg系统里面,
cgwindow,winid=0
cgset,32 ;这时候不是0具体是多少可以这样
wid=cgquery()
cgset,wid[0]
cgplot,indgen(10),/window ;必须带window关键词


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


*例1,在屏幕的固定比例上显示字符,与图形的frame无关
== cghistoplot ==
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 ===
[[直方图#cghistoplot|直方图]]
[[直方图#cghistoplot|直方图]]



2016年6月12日 (日) 05:36的最新版本

数组运算

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

  • 可以使用/encapsulated开关生成eps图
  • 用cgPS_Close, /PNG,可同时多生成一个同名的png图
  • 似乎在nomatch下,和一些关键词不兼容,cgplot甚至不如plot

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产生的窗口中

  • 如何指定 window/cgwindow
在原生IDL里面,用window,n ; wset n来制定window
cg系统里面,
cgwindow,winid=0
cgset,32 ;这时候不是0具体是多少可以这样
wid=cgquery()
 cgset,wid[0]
cgplot,indgen(10),/window ;必须带window关键词

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库