how to draw a image with color bar on real page (draw color bar on parea)

Dave Allured dave.allured at NOAA.GOV
Thu Feb 24 16:21:17 EST 2005


Hello z z.

The default operation of cbarn is to plot the color bar in one of the
margins OUTSIDE of the plot area (parea).  Since your script defines the
plot area to occupy the entire page, there are no remaining margins in
which to plot the color bar.  Therefore it is not displayed.

However, cbarn has extra arguments to manually position the color bar
anywhere you want on the page, including inside the plot area.  I think
this is what you want.  Please read the documentation at the top of the
cbarn.gs Grads script.  You will have to specify the arguments sf and
vert in addition to the x and y midpoint coordinates:

   ftp://grads.iges.org/grads/scripts/cbarn.gs

Sorry I did not catch this in my first answer.

--Dave

z z wrote:
> Hi Dave
> It still did not work when I put the run cbarn up one line.
> The script like this
>
> 'clear'
> 'open ctlFile.ctl'
> 'set lon -67 -59'
> 'set lat 42 47'
> 'set lev 1000'
> 'set t 1'
> 'set clab forced'
> 'set map 1 1 5'
> 'set mpdset hires province.dat'
> 'set grads off'
> 'set gxout shaded'
> 'set vpage 0 11 0 8.5'
> 'set parea 0 11 0 8.5'
> 'd t'
> 'run cbarn'
> 'printim result.png x480 y300 black'
>
> But If I only take off the sentence 'set parea 0 11 0 8.5' only keep
> 'set vpage 0 11 0 8.5', then the color barn will be drawed on the
> image
>
> Any suggestion?
>
> many Thanks
>
>
> On Mon, 21 Feb 2005 14:38:22 -0700, Dave Allured <dave.allured at noaa.gov> wrote:
>
>>I think you have a mistake in your script.  You have the run cbarn
>>command after the printim command.  This means that the color bar will
>>not be included in the output file result.png.
>>
>>Try moving the run cbarn command up one line.
>>
>>--Dave
>>
>>z z wrote:
>>
>>>hi all
>>>1. I want to draw a color bar with cbarn.gs. But this color bar seems
>>>have to be draw on a vpage. I need a image without title, axix lale
>>>etc.
>>>The part of the script file likes:
>>>
>>>'open test.ctl'
>>>'set lon -67 -56'
>>>'set lat 40 50'
>>>'set t 1'
>>>....
>>>'set vpage 0 11 0 8.5'
>>>*'set parea 0 11 0 8.5'
>>>'set xlab off'
>>>'set ylab off'
>>>'set gcout shaded'
>>>'d z'
>>>'printim result.png x800 y600 white'
>>>'run cbarn 1 0 5.5 0.8'
>>>'quit'
>>>
>>>if i used "set vpage  ' the color bar will be drawed on the bottom of
>>>the visual image. while it did not work on the parea.
>>>
>>>Any suggestion?
>>>
>>>2 Is there any way to define the output interval of a variable?
>>>For example, there is a temprature variable defined in the control
>>>file. The output may range from 10 degree to 20 degree (11 lines with
>>>1 degree interval) for a particular coordinate ((-67, -56) (42 48)) If
>>>I cahnge the narrow the coordinate to ((-65,-60) (43 46)), I still
>>>want there are 11 lines displayed on the image (may 0.3 degree
>>>interval).How can I do this?
>>>
>>>Thanks a lot
>>



More information about the gradsusr mailing list