PLOTMAN Methods and Parameters

Kim Tolbert 28 Nov 2012

 

Creating a plotman object

Plotman Functions

Plotman Procedures

Plotman Colors

Plotman Parameters

Examples

 

Note: This documentation is not complete. It is a work in progress.

In the following examples, p is the plotman object reference.

Creating a plotman object

p = plotman()

 

Or when you have an xyplot, utplot, specplot, or map object, just call

xyplot_obj -> plotman

To return the plotman object reference (e.g. to send more plots to same plotman instance):

xyplot_obj -> plotman, plotman_obj=p

Plotman Functions

PLOTMAN method call Returned value
z = p->get(/xyz) Value of xyz control parameter  (any of parameters in plotman_plot_control__define or in plotman properties (list at bottom of plotman__define)
current_panel_number = p->get(/current_panel_number) Current panel number
current_panel_desc = p->get(/current_panel_desc) Current panel description
current_panel_struct = p->get(/current_panel_struct) Structure with all of the information for the current panel, e.g.

help,current_panel_struct

** Structure <17e07da0>, 6 tags, length=9464, data length=9394, refs=3:
W_DRAWBASE LONG 6489
W_DRAW LONG 6490
WINDOW_ID INT 38
PLOT_CONTROL STRUCT -> PLOTMAN_PLOT_CONTROL Array[1]
SAVED_DATA STRUCT -> PLOTMAN_SAVED_DATA Array[1]
DESCRIPTION STRING 'efz20020212.214810 SOHO EIT 195 12-Feb-2002 21:48:10.580 (14:04:09)'

panel = p->desc2panel(panel_desc) Pointer to panel structure matching panel description

Optional keywords:
; number - if set, then returns number of panel instead of pointer to panel structure.
; all - if set, and number is set, then returns all panel numbers that match description passed in.
; (all has no effect if number is not set.)
; latest - if set, returns most recent panel matching description. Otherwise returns first one found.
; strip_time - if set, remove panel creation time from panel descriptions before checking

desc = p->get(/all_panel_desc) String array containing the panel description for all panels.
panel_types = p->get(/all_panel_plot_type)
 
String array containing the plot type for all panels: image, xyplot, utplot, or specplot
panels = p->get(/panels) Linkedlist object that contains all the information for all the panels.  Use get_count method to see how many panels are stored, get_item method to get info for a panel, e.g.

print, panels->get_count()
panel2 = panels->get_item(2)
help,*panel2

** Structure <17e07650>, 6 tags, length=9464, data length=9394, refs=1:
W_DRAWBASE LONG 6479
W_DRAW LONG 6480
WINDOW_ID INT 36
PLOT_CONTROL STRUCT -> PLOTMAN_PLOT_CONTROL Array[1]
SAVED_DATA STRUCT -> PLOTMAN_SAVED_DATA Array[1]
DESCRIPTION STRING '20120220_110000_s4c1B.fts STEREO_B SECCHI COR1 0 20-Feb-2012 11:00:41.222 (14:03:42)'

panel_times = p->get_panel_times(panel_numbers) Time intervals for each panel specified.

panel_times = p->get_panel_times([2,3,4])
ptim,panel_times

20-Feb-2012 11:00:41.222 20-Feb-2012 11:00:42.922
20-Feb-2012 11:00:50.223 20-Feb-2012 11:00:51.922
12-Feb-2002 21:48:10.580 12-Feb-2002 21:48:23.178

axis = p->getaxis( [/ut, /xaxis, /yaxis) Axis requested.  Use one of these keywords: /ut, /xaxis, /yaxis.  This doesn't work for all saved object types (like map?).

 

Plotman Procedures

0->set,xyz=value Set plotman parameter xyz to value.
p->select If currently selected panel is valid, then sets and shows the window corresponding to that panel, and restores the plot control for that panel.  If you want to add to a plot or replot it, you must call select first.
p->plot Plot currently selected panel.  Can pass in any values stored in plot_control as keywords.
p->unselect Unset focus and plot options from current panel (basically call wset,-1 and cleanplot) so that any non-plotman plot a user draws does not show up in plotman window, and has a default set of plot parameters.
p->show_panel, panel_numbers=panel_numbers Display panels with numbers panel_numbers in plotman.  Optional keywords:

; maximize - display panel panel_number
; p2x2 - display first four panels 2 across, 2 down
; showall - show all panels
; nacross - number of plots to show in x direction
; all_1across - stack plots, so only one plot in x direction
; lineplots_1across - always show lineplots (xy, ut) using full width, i.e. one plot in x direction
; Depending on how many panels to show, it figures out how big each panel it is going to show
; should be, resizes the draw widget, and displays it.

p->delete_panel, panel_number=panel_number Delete panel pnael_number.  Optional keywords:

current - if set, delete current panel
all - if set, delete all panels

p->reset_panel_pc, struct, panels=panel_mask Modify the plot control structure saved in panels specified by panel mask (i.e. panel_mask is an array of 0s and 1s, to change fourth panel, call with panels=[0,0,0,1])
struct is a structure containing the items in plot control to change.
For example to change the color table to table 5 for panels 0,1,2:
  p->reset_panel_pc, {colortable: 5}, panels=[1,1,1]
Or to change the red,green,blue arrays to prefilled arrays in r,g,b:
  p->reset_panel_pc,{red: r, green:g, blue: b}, panels=[1,1,1]
p->create_plot_file Creates a plot file from the current panel. Keywords:

ps - if set, create PostScript file
png - if set, create PNG file
tiff - if set, create TIFF file
jpeg - if set, create JPEG file
filename - output plot file name

For PostScript plots:
landscape - set to 0 or 1 for portrait or landscape plots
xsize,ysize - x and y size of plot
xoff,yoff - x and y offset from bottom left corner in portrait (remember, if landscape, this will be the bottom right corner, i.e. portrait was rotated counter-clockwise)

Examples:

To plot PS in portrait mode:
p->create_plot_file,/ps,filename='x.ps',landscape=0,xsize=7.5,ysize=10.,xoff=.6,yoff=.6

To plot PS in landscape mode
p->create_plot_file,/ps,filename='x.ps',/landscape,xsize=10.,ysize=7.5,xoff=.6,yoff=10.4
 

 

Plotman Colors

Plotman reserves 17 slots at the top end of its stored colortable for discrete colors.  For each panel, plotman stores three 256 element byte arrays - rcolors, gcolors, and bcolors.  The red, green, blue arrays corresponding to the user's choice of colortable are compressed into the first 239 spaces in the rcolors, gcolors, bcolors arrays and the top 17 slots always contain the same discrete colors.  The names and indices of those discrete colors can be retrieved as follows:

c=p->get(/color_names)
IDL> help,c,/st
** Structure PLOTMAN_COLOR_NAMES, 17 tags, length=34, data length=34:
VIOLET  239
LIME  240
BLACK  241
MAROON  242
RED  243
PINK  244
ORANGE  245
YELLOW  246
OLIVE  247
GREEN  248
DKGREEN  249
CYAN  250
BLUE  251
DKBLUE  252
MAGENTA  253
PURPLE  254
WHITE  255

In the GUI, users select the colortable through the Plot Control / Image Display Options widget.  To change colors at the command line, users can either set the colortable number, or set the red, green, and/or blue arrays. In either case, the colors will be compressed to the first 239 space in the stored plotman color table.  e.g.

p->set,colortable=5
or
p->set,red=indgen(256)

To replot a panel with the new colors, a second select must be called before plotting, i.e.

p->select
p->set,colortable=6
p->select
p->plot

Colors:

Plotman Parameters


In progress...
COLORS
red  
green  
blue  
colortable  
   
   
   
   
   
   
   

EXAMPLES

  1. Extract the data object for a panel

    To retrieve the data object stored for the second panel in plotman:

    panels=p->get(/panels) ; returns a linkelist object with panel information
    print,panels->get_count()  ; prints number of panels stored
    p1 = panels->get_item(1) ; gets second panel stored (0 is first)
    saved_data = (*p1).saved_data
    dobj = *saved_data.data

     

  2. Using a map object that contains multiple maps with plotman and changing the colors of some of the maps:

    omap=obj_new('map')
    for k=0,3 do omap->setmap,k,make_map(100*randomn(seed)*dist(64),id=string(k))

    ;first plot all four objects with color table 3
    loadct,3
    tvlct,r,g,b,/get
    for k=0,3 do omap->plotman,k,plotman=p,red=r,green=g,blue=b

    ; now get r,g,b arrays for color table 5, and replace the first and second panels with that color table
    loadct,5
    tvlct,r,g,b,/get
    for k=0,1 do omap->plotman,k,plotman=p,red=r,green=g,blue=b, nodup=0, /replace

    ; now get r,g,b arrays for color table 32 and use reset_panel_pc to change the saved colors for the third and fourth panels and replot all 4 panels

    loadct,32
    tvlct,r,g,b,/get
    p->reset_panel_pc, {red:r, green:g, blue:b}, panels=[0,0,1,1]
    p->show_panel, /all, nacross=2

    ; now use reset_panel_pc to change the saved color table for the second panel 2 to color table 5 and replot all 4 panels
    p->reset_panel_pc, {colortable: 5}, panels=[0,1]
    p->show_panel, /all, nacross=2
     

  3. Create a utplot object with two y arrays and errors and plot in plotman:

    ; This part just sets up a 2,10 time array and arrays for y1 and y2 and their corresponding error arrays
    t = anytim('12-sep-2012 10:00') + findgen(12)*10.d
    t=get_edges(t,/edges_2)
    y1=findgen(10) & y2=findgen(10)+2.
    y1_err=fltarr(10) + .5 & y2_err=fltarr(10) + 1.

    ; create utplot object using plotman

    ut_obj = obj_new('utplot', t, [[y1],[y2]], [[y1_err],[y2_err]])
    ut_obj->set,dim1_ids=['y1 data', 'y2 data'], id='Using utplot object', data_unit='y units'
    ut_obj->plotman,desc='testerr'