FAQ

setting plot background color

setting plot background color

Question:

How can I set the background of a plot to a custom color?

 

Example:

Window drawn after using PyFerret SET WINDOW/COLOR=

 

Solution:

 

In PyFerret, the SET WINDOW command includes a /COLOR qualifier for setting the window color, along with other characteristics including opacity.

>pyferret
yes? set win/color=red
yes? go ptest
 
! Or use a more subdued custom color,
yes? set win/color=set win/color=(40,60,60)
...

 

Using classic-Ferret one has to use a trick. Use viewports that can do a 100% job of filling the background -- or any portion(s) of it -- with your choice of colors. Multicolored backgrounds are possible through straightforward extension using multiple viewports. (This technique works identically in PyFerret.)

Example: -- using overlapping viewports

! Use identical viewports "full" (predefined) and "full2"
define view full2
 
! Set the background color
set view full
go magnify 1000
shade/i=1:2/j=1:2/palette=red/nolabels/nokey (i+j)
 
! Now make your plot in the viewport "full2"
set view full2
go ptest