[Thread Prev][Thread Next][Index]

Re: [ferret_users] many colors and shaset



Hi,
Thank you for the example script. Let me explain what Ferret is doing with the colors. Ferret keeps is a list of colors-used.  Each color graphics command sets part of that list, up to the maximum of 256 colors. This is not the colors actually drawn, but those which may be used, as defined by /LEVELS qualifier. /LEVELS=(0,7,1) defines 8 colors, even if the data that is plotted by the command needs only one color. Ferret does not check whether the colors  that are defined in the current command are the same as those already defined.  Your script defines 8 colors for each polygon call, using 8 items in the list for every call to the polygon command. There are 12*6 = 70 calls to polygon in each figure, plus the legend.  So all of the 256 color indices are used before the end of the repeat loops.

PPL SHASET RESET moves the pointer in the color list back to the start, removing any memory of colors already used. Usually we don't want to use this while there are colors on the plot page that we want to keep.  But because each set of six polygons uses the same color palette and levels setting, we can issue PPL SHASET RESET at the start of each set of polygons. This keeps the pointer in the color list to a low number so we don't run out of colors. We do not want to issue PPL SHASET RESET before changing palettes and using the white palette for the legend, so put it at the start of each set of polygons that share colors.

There is some discussion of this, here, the index entry is "color, PPLUS shading",
http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/customizing-plots/COLOR#_VPINDEXENTRY_828

So, your script could be changed as follows:

Set W /Aspect=1.6

PPL AXLSZE .18 .18
PPL TICS 0.125 0.25 0. 0. 1 1
PPL AXLABP -1 0
PPL AXLINT 1

Define Viewport /X=0.3:1.0 01

Def Symb xd001   0 ; Def Symb xu001  20 ; Def Symb xi001 5
Def Symb yd001   0 ; Def Symb yu001 310

!! Figure 1
!! ########

Set V 01
go margins 0.5 0.5 0.9 0.2

Plot /Nolab /I=1:2 /Hlim=($xd001):($xu001):($xi001) /Vlim=($yd001):($yu001) /Vgrat=dash /Set I
ppl xfor (F4.0)
ppl Plot

Def Symb inc0  =   4
Def Symb inc1  =   4
Def Symb ordup = `($yu001) - ($inc1)`
Def Symb orddo = `($ordup) - ($inc0)`

Repeat /Range=1:12 /Name=dd ( ppl shaset reset;\
Repeat /Range=1:6 /Name=ii ( \
  Def Symb ii `ii` ;\
  Polygone /Over /Line /Nolab /Fill /Pal=broad /Lev=(0,7,1) {0,0,`($ii)*3`,`($ii)*3`}, {($orddo),($ordup),($ordup),($orddo)}, `($ii)-1` ;\
  Def Symb ordup =  `($orddo)+1` ;\
  Def Symb orddo = `($ordup)-($inc0)` ;\
) ;\
  Def Symb ordup = `($ordup)-($inc1)` ;\
  Def Symb orddo = `($ordup)-($inc0)` ;\
)

 !! Legend
Polygone /Over /Line /Nolab /Fill /Pal=white {4,4,18,18}, {2,`($ordup)+3`,`($ordup)+3`,2}

Repeat /Range=1:6 /Name=ii ( \
  Def Symb ii `ii` ;\
  Polygone /Over /Line /Nolab /Fill /Pal=broad /Lev=(0,7,1) {5,5,10,10}, {($orddo),($ordup),($ordup),($orddo)}, `($ii)-1` ;\
  Def Symb ordup =  `($orddo)-3` ;\
  Def Symb orddo = `($ordup)-($inc0)` ;\
)


Frame /File=fig01.gif
ppl Shaset Reset

!! Figure 2
!! ########  ...




On 2/3/2012 5:56 AM, Bruno Levier wrote:
Hi Ferreters

I'm trying to plot many polygones filled with different colors on the same plot. When I use "ferret -gif", the colors are not always those expected (in this case the rectangle of the legend is filled with brown rather than white). I've tried to use some "shaset protect" but with no success. I've attached the script I use. I use Ferret v6.2

Thank you for your help,

Bruno Levier



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

Privacy Policy | Disclaimer | Accessibility Statement