source: trunk/SRC/ToBeReviewed/PLOTS/symbols.pro @ 378

Last change on this file since 378 was 378, checked in by pinsard, 16 years ago

improvements of headers (typo, links, paragraphes, etc)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.5 KB
Line 
1;+
2;
3; @file_comments
4; Create custom plotting symbols
5;
6; @param NSYM {in}{required} {type=integer}
7; Code of sympbols :
8; 1 = open circle
9; 2 = filled circle
10; 3 = arrow pointing right
11; 4 = arrow pointing left
12; 5 = arrow pointing up
13; 6 = arrow pointing down
14; 7 = arrow pointing up and left (45 degrees)
15; 8 = arrow pointing down and left
16; 9 = arrow pointing down and right.
17; 10 = arrow pointing up and right.
18;
19; 11 through 18 are bold versions of 3 through 10
20;
21; 19 = horizontal line
22; 20 = box
23; 21 = diamond
24; 22 = triangle
25; 30 = filled box
26; 31 = filled diamond
27; 32 = filled triangle
28;
29; @param SCALE {in}{required}
30; size of symbols.
31;
32; @keyword COLOR
33; color of symbols
34;
35; @restrictions
36; The desired symbol is stored in the user buffer and
37; will be plotted if !P.PSYM = 8.
38;
39; @history
40; Jeff Bennett, U of Colorado, 198?
41;
42; @version
43; $Id$
44;
45;-
46PRO symbols, nsym, scale, COLOR=col
47;
48  compile_opt idl2, strictarrsubs
49;
50on_error,2
51fill = 0
52case 1 of
53     (nsym le 2):   begin                         ;circles
54                      ;for large scales increase number of points for res.
55                      if scale ge 4 then a = findgen(25) else $
56                      a = findgen(13)
57                      a = a * (3.14159 / 6.)       ;(0 - 12 or 24) pi/6
58                      xarr = cos(a)
59                      yarr = sin(a)
60                      if nsym eq 2 then fill = 1
61                    end
62     ((nsym ge 3)*(nsym le 18)):   begin           ;arrow heads
63                      xarr = fltarr(5)
64                      yarr = xarr
65                      xarr[1] = 10.
66                      xarr[2] = 6.
67                      yarr[2] = 2.
68                      ;nsyms greater than 10 should be filled arrows
69                      if nsym gt 10 then begin
70                         xarr[3] = 6.
71                         xarr[4] = 10.
72                         yarr[3] = -2.
73                         fill = 1
74                      endif else begin
75                         xarr[3] = 10.
76                         xarr[4] = 6.
77                         yarr[4] = -2.
78                      endelse
79                      case 1 of
80                         (nsym eq 3): dummy = 0b
81                         (nsym eq 4): xarr = -1.*xarr
82                         ((nsym eq 11)+(nsym eq 12)): begin
83                            xarr = extrac(xarr,0,11)
84                            yarr = extrac(yarr,0,11)
85                            yarr[6] = 0.5
86                            xarr[7] = 6
87                            yarr[7] = 0.5
88                            xarr[8] = 6
89                            yarr[8] = -0.5
90                            yarr[9] = -0.5
91                            if nsym eq 12 then begin
92                               rotation,xarr,yarr,180,nx,ny
93                               xarr = nx
94                               yarr = ny
95                            endif
96                                                     end
97                         ((nsym eq 5)+(nsym eq 13)): begin
98                            temp = xarr
99                            xarr = yarr
100                            yarr = temp
101                                                     end
102                         ((nsym eq 6)+(nsym eq 14)): begin
103                            temp = -1.*xarr
104                            xarr = yarr
105                            yarr = temp
106                                                     end
107                         ((nsym ge 7)*(nsym le 10) + $
108                         (nsym ge 15)*(nsym le 18)): begin
109                            case 1 of
110                                 ((nsym eq 7)+(nsym eq 15)): deg = 45
111                                 ((nsym eq 8)+(nsym eq 16)): deg = 135
112                                 ((nsym eq 9)+(nsym eq 17)): deg = 225
113                                 ((nsym eq 10)+(nsym eq 18)): deg = 315
114                            endcase
115                            rotation,xarr,yarr,deg,nx,ny
116                            xarr = nx
117                            yarr = ny
118                                                  end   ;end nsym ge 7
119                      endcase
120                                   end    ;nsym between 3 and 18
121     ((nsym eq 20)+(nsym eq 21)+(nsym eq 30)+(nsym eq 31)):  begin
122                      xarr = fltarr(5) + 3
123                      yarr = xarr
124                      xarr[1] = -3.
125                      xarr[2] = -3.
126                      yarr[2] = -3.
127                      yarr[3] = -3.
128                      if (nsym eq 21)+(nsym eq 31) then begin
129                         rotation,xarr,yarr,45,nx,ny
130                         nx = 0.70 * nx     ;shrink the x direction
131                         xarr = nx
132                         yarr = ny
133                      endif
134                      if nsym ge 30 then fill = 1
135                                   end    ;nsym 20,21,30,31
136     ((nsym eq 22)+(nsym eq 32)):  begin  ;side length 6, 0 at centroid
137                      yarr = fltarr(4) - 6./4.
138                      xarr = fltarr(4) - 6./2.
139                      xarr[1] = 6./2.
140                      xarr[2] = 0.
141                      yarr[2] = 6.*sqrt(3.)/2. - 6./4.
142                      if nsym eq 32 then fill = 1
143                                    end
144     else:                          begin
145                      xarr = fltarr(2) + 1
146                      yarr = xarr * 0.
147                      xarr[1] = -1.
148                                    end
149endcase
150;
151xarr = xarr * scale
152yarr = yarr * scale
153;
154;set symbol buffer
155if keyword_set(col) then usersym,xarr,yarr,fill=fill,color=col else $
156  usersym,xarr,yarr,fill=fill
157;
158return
159end
Note: See TracBrowser for help on using the repository browser.