[Thread Prev][Thread Next][Index]
[ferret_users] Trick to enhance SHADE figures under a vector graphics software
Dear Ferret users,
I'm a beginner under ferret and I came up with a trick to enhance the
appearance of my figures that involve the SHADE command. Perhaps it will
be of interest to some of you.
Limitations: the trick does not work well with the FILL command (use
SHADE instead), and is not suitable for figures having many (10+) levels
inside the colorbar. The trick also requires the Inkscape graphics
software (freely available over many platforms). Of course it should be
possible to do the same under Corel Draw or Illustrator; I just don't
have access to these tools.
From what I understand by playing with figures produced with the SHADE
command, ferret 'paints' these figures using thin rectangles (slabs),
and starts a new rectangle each time it comes across a different color
(a different level in the colorbar). If you open a postscript or pdf
file under any viewer that uses anti-aliasing (most Acrobat Reader and
the latest Evince have this feature enabled), the thin rectangles will
show as ugly 'lines' covering the figure.
Figures produced with the FILL command do not show these lines, but they
are somewhat bigger in size as the number of rectangles is nearly
doubled (they are overlapped). These hundreds of rectangles make the
figures hard to modify under vector graphics software.
The basic idea is to bring together all rectangles of the same color, so
that they become a single entity (a filled path). The result looks like
a jigsaw puzzle with each color (level) being one piece of the puzzle.
It is then easy to apply changes such as modification of the colors, add
gradients, simplify path, etc.
Example:
use etopo40
! We want a postscript file
set mode metafile
! We will draw the North Atlantic
set region/X=-80:0/Y=0:70
! Roughly adjust window x/y aspect so that things are not too ugly
set window/aspect=1.4
! We will paint Earth with a solid color
let earth = if rose[d=1] ge 0. then 0. else (-1.E+34)
! Draw a few levels for ocean depths
shade/levels=(-inf)(-4000,0,1000)/pal=bluescale rose[d=1]
! Overlay the Earth, painted in dark gray
shade/over/nokey/nolab/noaxes/pal=gray_dark earth
! We could go fancier but stop here and close the metafile
ppl clsplt
! Convert metafile to postscript
spawn Fprint -p portrait -o toto.ps metafile.plt
! Convert postscript to svg (for Inkscape)
spawn pstoedit -f plot-svg toto.ps toto.svg
! done, now let's load the svg file into Inkscape.
Open the svg file into Inkscape. Note the ugly lines caused by the
anti-aliasing of Inkscape.
Start by ungrouping the figure (shift-control-g). You will see that the
SHADE command produced hundreds of thin individual slabs. We want to
operate a fusion of the slabs sharing a same color. Thus we want to
'Select objects by color'.
Let's start with Earth (dark gray slabs). Click on any of these Earth
slab and hit shift-control-f which gives information about the color.
Note the first 6 values of the color code in the bottom-right part
(4c4c4c) which means dark gray. Now we will ask Inkscape to select all
the objects sharing this attribute. Type ctrl-f (find) and insert the
color code in the Style box. Hit 'Search'. Now all dark gray slabs
should be selected.
The next step is to convert the dark gray slabs into one path. This
function is under 'Path' menu, and then 'Union'. Note that the dark gray
slabs are replaced by a unique solid, nice-looking dark gray Earth. Just
do the same for the other colors inside the colorbar.
The resulting file is about twice the size of the original postscript. I
find this a small price to pay as the resulting file allows all the
advanced manipulations possible with paths. And the ugly lines are gone.
I'm far from being a ferret or inkscape wizard, so please keep me in
touch if you have any suggestions or improvements over the above procedure.
Pierre
(Pierre.St-Laurent@xxxxxxxxxxxxxxxx)
[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Privacy Policy | Disclaimer | Accessibility Statement