;+ ; NAME: ; DEFINE_PSYM ; PURPOSE: ; Set up the psym variable for plots, with pre-defined symbols ; EXPLANATION: ; Data points in plots can be drawn with symbols, defined with the ; IDL native command USERSYM. Present routine provides a quick way ; to set USERSYM with pre-defined symbols (circle, square, star...) ; ; CALLING SEQUENCE: ; DEFINE_PSYM, SIZE, [SYMBOL=SYMBOL, COLOR=COLOR, THICK=THICK] ; ; INPUTS: ; SIZE = The size of the symbol in the plot (unit of character size) ; ; OPTIONAL INPUT KEYWORDS: ; SYMBOL = An integer selecting the shape of the symbol ; 00 : Nothing ; 01 : Circle ; 02 : Square ; 03 : Triangle ; 04 : Reversed Triangle ; 05 : Pentagone ; 06 : Star ; 11 : Filled Circle ; 12 : Filled Square ; 13 : Filled Triangle ; 14 : Filled Reversed Triangle ; 15 : Filled Pentagone ; 16 : Filled Star ; ; COLOR = Index of the color [0-255], independant from the color table ; ; THICK = Thickness of the symbol lines ; ; ; EXAMPLE: ; Draw two sets of random point as circles and filled stars ; IDL> define_psym, 1, symbol=01, color=255 ; IDL> plot, randomn(1,10),psym=8 ; IDL> define_psym, 2, symbol=16, color=90 ; IDL> oplot, randomn(2,10),psym=8 ; ; PROCEDURES USED: ; Procedures: USERSYM ; ; MODIFICATION HISTORY: ; Original Version written in 2007, B. Carry (ESO/LESIA) ; 2013 Mar. - B.Carry (IMCCE) - New set of symbols (pentagone, stars) ;- pro define_psym, size, $ SYMBOL=SYMBOL, $ COLOR=COLOR, $ THICK=THICK ;-------------------------------------------------------- ;--1-- Set Variables to Default if Needed if not keyword_set(symbol) then symbol = 11 if not keyword_set(color) then color = 0 if not keyword_set(thick) then thick = 1 ;-------------------------------------------------------- ;--2-- Create a Null Symbol if symbol eq 0 then begin USERSYM, [0],[0] endif ;-------------------------------------------------------- ;--3--Create the Symbols case symbol of ;-------------------------------------------------------- ;--3.1-- Unfilled Symbols ;--3.1.1-- Create a Unfilled Circle Symbol 1: BEGIN angle = findgen(37) * (2.*!PI/36.) USERSYM, size*cos(angle), size*sin(angle), $ color=color, thick=thick END ;--3.1.2-- Create a Unfilled Square Symbol 2: BEGIN angle = findgen(5) * (!PI/2.) + (!PI/4.) USERSYM, 1.2*size*cos(angle), 1.2*size*sin(angle), $ color=color, thick=thick END ;--3.1.3-- Create a Unfilled Triangle Symbol 3: BEGIN angle = findgen(4) * (2.*!PI/3.) + (!PI/2.) USERSYM, 1.1*size*cos(angle), 1.1*size*sin(angle), $ color=color, thick=thick END ;--3.1.4-- Create a Unfilled Reverse Triangle Symbol 4: bEGIN angle = findgen(4) * (2.*!PI/3.) - !PI/2. USERSYM, 1.2*size*cos(angle), $ 1.2*size*sin(angle), $ color=color, thick=thick END ;--3.1.5-- Create a Unfilled Pentagone 5: BEGIN angle = findgen(6) * (2.*!PI/5.) + !PI/10. USERSYM, 1.1*size*cos(angle), $ 1.1*size*sin(angle), $ color=color, thick=thick END ;--3.1.6-- Create a Unfilled Star 6: BEGIN angle = findgen(11) * (2.*!PI/10.) + !PI/10. radii = findgen(11) odd=where( (radii mod 2) eq 0, comp=even ) radii(odd) = 1.5*size radii(even)= 1.5*size/3. USERSYM, radii*cos(angle), $ radii*sin(angle), $ color=color, thick=thick END ;-------------------------------------------------------- ;--3.2-- Filled Symbols ;-3.2.1-- Create a Filled Circle Symbol 11: BEGIN angle = findgen(37) * (2.*!PI/36.) USERSYM, size*cos(angle), size*sin(angle), $ color=color, /FILL, thick=thick END ;--3.2.2-- Create a Filled Square Symbol 12: BEGIN angle = findgen(5) * (!PI/2.) + (!PI/4.) USERSYM, 1.2*size*cos(angle), 1.2*size*sin(angle), $ color=color, /FILL, thick=thick END ;--3.2.3-- Create a Filled Triangle Symbol 13: BEGIN angle = findgen(4) * (2.*!PI/3.) + !PI/2. USERSYM, 1.1*size*cos(angle), 1.1*size*sin(angle), $ color=color, /FILL, thick=thick END ;--3.2.4-- Create a filled Reversed Triangle Symbol 14: BEGIN angle = findgen(4) * (2.*!PI/3.) - !PI/2. USERSYM, 1.2*size*cos(angle), $ 1.2*size*sin(angle), $ color=color, /FILL, thick=thick END ;--3.2.5-- Create a Filled Pentagone 15: BEGIN angle = findgen(6) * (2.*!PI/5.) + !PI/10. USERSYM, 1.1*size*cos(angle), $ 1.1*size*sin(angle), $ color=color, /FILL, thick=thick END ;--3.2.6-- Create a Filled Star 16: BEGIN angle = findgen(11) * (2.*!PI/10.) + !PI/10. radii = findgen(11) odd=where( (radii mod 2) eq 0, comp=even ) radii(odd) = 1.5*size radii(even)= 1.5*size/3. USERSYM, radii*cos(angle), $ radii*sin(angle), $ color=color, /FILL, thick=thick END ELSE: USERSYM, [0],[0] ENDCASE end