Color legend in horizontal / vertical position (cbarn)

Antoy Chang antoyc at YAHOO.COM
Thu Feb 5 00:07:21 EST 2009


Dear James,
I've tried but still fail. Below is the part of gs for display the graphic :
 

  'set grads off'
  'set parea 0.5 7.7 0.5 9.5'
  'set mpdset /usr/local/lib/grads/hires'
  'set map 1 1 2'
  'set annot 1'
  'set gxout shaded'
  'set clevs 'colndx
  'set ccols 'colevs
* 'd wht*1.25'
  'd wht'
  'run /usr/local/lib/grads/script/cbarn.gs 1.0 1 7.9 4.9'
  'set gxout vector'
  'set ccolor 1'
  'set arrscl 0.15'
  'define wamv=cos(0.0174532*wdir)'
  'define wamu=sin(0.0174532*wdir)'
  skp=4
  'd skip(wamu,'skp','skp');wamv'
  'set gxout contour'
  'set cint 1'
  'set clab forced'
  'set ccolor 0'
  'd mpr'
   'draw string 7.5 0.35 'metres 
*
*'draw title MMS-WAM Significant Wave Heights(shaded contours), \ wave directions(vectors), mean wave period(seconds, white lines), *\  Valid Time '  FULL_DATE
*Edited by Nursalleh on 8/8/08***************************************************************
*'draw title MMD-WAM Significant Wave Heights(metres,shaded contours),\ mean wave period(seconds, white lines), \  Valid Time ' the_day_LT ' '  FULL_DATE
'draw title MMD-WAM Significant Wave Heights(metres,shaded contours),\ mean wave period(seconds, white lines),\ Wave Direction(arrow) \  Valid Time ' the_day_LT ' '  FULL_DATE
********************************************************************************************
*'draw title 'MMS' 'WAM' 'Significant' 'Wave' 'Heights'\'Valid' 'Time' ' FULL_DATE
*  'draw title 'MMS' 'WAM' 'Significant' 'Wave' 'Heights'\'Valid' 'Time' ' vtime
*
*  for hard copy output
*
  pfn='wam't'.pfn'
  'enable print 'pfn
  'print'
  'disable print'

--- On Thu, 2/5/09, James T. Potemra <jimp at hawaii.edu> wrote:

From: James T. Potemra <jimp at hawaii.edu>
Subject: Re: Color legend in horizontal / vertical position (cbarn)
To: antoyc at yahoo.com
Date: Thursday, February 5, 2009, 9:20 AM

Antoy:

I'm not sure why grads would change the color bar from vertical to
horizontal if
you are really not changing the page/graphics size.  But, you can give the
color
bar function optional arguments for size, orientation and location.  For
example,
"cbarn 0.5 0" will scale the colorbar by half (0.5) and make it
horizontal (0).  Here's
the top of the cbarn script with more details:

*  The script will assume a colorbar is wanted even if there is
*  not room -- it will plot on the side or the bottom if there is
*  room in either place, otherwise it will plot along the bottom and
*  overlay labels there if any.  This can be dealt with via
*  the 'set parea' command.  In version 2 the default parea will
*  be changed, but we want to guarantee upward compatibility in
*  sub-releases.
*
*
*       modifications by mike fiorino 940614
*
*       - the extreme colors are plotted as triangles
*       - the colors are boxed in white
*       - input arguments in during a run execution:
*
*       run cbarn sf vert xmid ymid
*
*       sf   - scale the whole bar 1.0 = original 0.5 half the size, etc.
*       vert - 0 FORCES a horizontal bar = 1 a vertical bar
*       xmid - the x position on the virtual page the center the bar
*       ymid - the x position on the virtual page the center the bar
*
*       if vert,xmid,ymid are not specified, they are selected
*       as in the original algorithm
* 
Hope this helps,

Jim

Antoy Chang wrote:
> Hi everybody,
> I have problem when displaying the 2 wave forecast using exactly the same
script but different color bar position (using cbarn) one is placed horizontally
while the other vertically. How to solve this?, i want to place both vertically,
the print area is exactly the same on both display. Why this inconsistency
happen?. Really appreciate your feedback.Thank You.
>  p/s : Look at the attached files.
>  --- On *Wed, 2/4/09, Madhusoodanan M.S.
/<madhusoodanan at GMAIL.COM>/* wrote:
> 
>     From: Madhusoodanan M.S. <madhusoodanan at GMAIL.COM>
>     Subject: Re: error in ctl file
>     To: GRADSUSR at LIST.CINECA.IT
>     Date: Wednesday, February 4, 2009, 10:11 PM
> 
>     hi,
> 
>     your script appears to have some problems.
> 
>     check the header of taux.cdf (ncdump -h taux.cdf ==> it will give
>     nx and ny.)
> 
>     'set x 129.5 320.5'   ==> ??? longitude will vary from 0
359.5 (if
>     global)
>     that means x will vary from 1 720 and
>                      y              from 1 361 (if from 90S to 90N)
> 
>     .ctl file to read the tauxobs.grd should be correctly made then.
> 
>     cheers,
>     Madhu
> 
> 
> 
>      
> 
>                                  'reinit'
>                 'sdfopen taux.cdf'
>                 'set gxout fwrite'
>                 'set fwrite tauxobs.grd'
>                 'set x 129.5 320.5'
>                 'set y 121.5 171.5'
>                 'set z 1'
>                 'set t 1 24'
>                 'd taux'
>                 'disable fwrite'
>                                  and the data length in tauxobs.grd is
193*52*24*4,
>                 where nx=193, ny=52, and t=24,
>                 so, where is the error in file i am not getting it,
>                 that is it display the variable for only time t=1, not
>                 for the other time,
>                 please help me.
>                                  with redgards
>                                  anushri
> 
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> 
> ------------------------------------------------------------------------
> 



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20090204/7148fb54/attachment.html 


More information about the gradsusr mailing list