[Thread Prev][Thread Next][Index]

Re: [ferret_users] Help making a color bar with two scales



Thanks.  Using your idea I was able to get what I wanted.

Roland


On Thu, Jul 11, 2013 at 4:56 PM, Ansley Manke <ansley.b.manke@xxxxxxxx> wrote:
Hi Roland,
I don't think there's any script already that would do this, but you have the right kind of idea calling something to draw the colorbar twice, with different labels.  The ccbar script is old, before the time of Ferret's open-ended color levels.

Here's an example where I draw the same plot twice, each in an identical viewport, but re-scaled.  Label the colorbar on the left with one scale and on the right with the other.

use coads_climatology

! plot the data, moving the color key over to the right, to leave space for the
! second set of labels. Put the labels for degrees-C on the left of the color bar.

can view
set view full
go margins 1.4 1.4 1.2 1.6  ! define a wider right-hand margin

fill/lev=(-inf)(0,30,1)(inf)/set sst[L=1]
ppl shakey,1,1,-0.1,,,,`($ppl$xlen)+1.8`,`($ppl$xlen)+2`, ($ppl$yorg), `($ppl$yorg)+($ppl$ylen)`
ppl fill

! save the location used for the color key to use again below.
let k1 = `($ppl$xlen)+1.8`
let k2 = `($ppl$xlen)+2`
let k3 = ($ppl$yorg)
let k4 = `($ppl$yorg)+($ppl$ylen)`

! make a label
let labx = `($ppl$xlen)+($ppl$xorg)-0.9`
let laby = -0.1
label/nouser `labx`,`laby`,0,-1,0.1,(Deg C)

! define a second, identical viewport, set the same margins
def view/x=0:1/y=0:1 full2
set view full2
go margins 1.4 1.4 1.2 1.6

! Make another plot using the desired second set of levels.
! Label the color bar on the right.

! convert SST and the range for levels to F

let sst_f = sst*9/5 + 32

let hi = 30*9/5 + 32
let lo = 0*9/5 + 32
let del = 1*9/5

fill/lev=(-inf)(`lo`,`hi`,`del`)(inf)/set/noax/nolab sst_f[L=1]
ppl shakey,,1,0.1,,-1,,`k1`,`k2`,`k3`,`k4`
ppl fill

go fland

! label
let labx = `labx+0.8`
label/nouser `labx`,`laby`,0,-1,0.1,(Deg F)



On 7/9/2013 6:54 PM, Roland Schweitzer - NOAA Affiliate wrote:
Hi,

Sorry if I missed something obvious, but I haven't been able to search up a solution.  The color bar on the left is what I'm trying to accomplish.  I hacked it up in an image editing program.  The middle color bar is what gets created auto-magically when making a shade plot with levels=(-inf)(-35, 110, 5)(inf) and the one on the right is my so far unsuccessful attempts to make such a scale using the ccbar.jnl script in the distribution. To get it, I run the guts of ccbar twice just changing the min, max and delta and the side upon which the ticks are written.  I don't get quite the range I expect using -35 110 5 in ccbar.jnl and I haven't figured out a technique to draw the nice triangles on the top and bottom.  Thanks in advance for any suggestions.

Roland




Attachment: ntmp_scale.png
Description: PNG image


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement