Re: Polygon outlines pen attributes: use -W together with -Gp?

Kristof Koch <[email protected]>
Newsgroups gmane.comp.gis.gmt.user
Message-ID <[email protected]>
Thank you Paul! 

That did the trick for me. Additionally, I plot the polygon a second time after the clipping is ended with a thin solid line. Together with the clipped fat translucent line I get the desired result.

All the best,
Kristof

Am 03.03.2014 um 08:36 schrieb Paul Wessel <[email protected]>:

> OK, perhaps a better and simpler idea is this:
> 
> 1. Lay down a clip path using your polygon with psclip
> 2. Now draw polygon in psxy with fat transparent pen, e.g., -W20p,red@50
> 3. Undo clipping with psclip -C
> 
> Now your pen is contained by the polygon and only goes on the inside.
> -p
> 
> On Mar 2, 2014, at 5:45 PM, Kristof Koch <[email protected]> wrote:
> 
>> Hi Paul,
>> 
>> Thank you for your detailed answer. Doesn't your approach have the same problems with map distortion? As far as I understand your solution (step 4), the border will look wider in high latitudes compared to lower latitudes when running parallel to a circle of latitude on a Mercator projection or doesn't it? The thing I'm after is similar to a simple pen (constant width all over the plot) but with a fancy stroke. 
>> 
>> All the best,
>> Kristof
>> 
>>> Am 03.03.2014 um 04:18 schrieb Paul Wessel <[email protected]>:
>>> 
>>> You could compute the distance from your polygon outline to points on a grid, then use grdmath to set all distances larger than $margin (in km) to NaN, and then paint that grid with some cpt so that you get fill just near the edges of the polygon, with nothing in the middle.  The fill could be constant or gradually fade away.
>>> 
>>> E.g., given polygon.txt, do something like
>>> 
>>> 1. R=`gmt info polygon.txt -I11    # Get rectangular region of polygon to nearest whole degree
>>> 2. grdmath $R -I1 -fg polygon.txt LDIST polygon.txt = dist.nc    # Compute distances from the perimeter
>>> 3 grdmask -Rdist.nc polygon.txt  -NNaN/1/1 -Gmask.nc    # Get a mask grid for the inside of the polygon
>>> 4. grdmath dist.nc mask.nc MUL DUP $margin LE 0 NAN MUL = margin.nc
>>>  # Set nodes outside polygon to NaN, then set nodes more than $margin km away from perimiter to NaN as well.
>>> 5. echo "0    red    $margin    red" > red.cpt    # Make a cpt that is either constant or linearly decaying from 0-$margin
>>> 5. grdimage -R -J margin.nc -Cred.cpt -Q -O -K >> ...
>>> 
>>> Paul
>>> 
>>>> On Mar 2, 2014, at 3:58 PM, Kristof Koch <[email protected]> wrote:
>>>> 
>>>> Dear List,
>>>> 
>>>> I have an arbitrary closed polygon occasionally way larger than my plot. I'd like to indicate the inside side of the polygon without filling the whole area. My idea is to have a solid outline (regular -W option) and add a fill pattern of specified width to the inside side of the outline. 
>>>> 
>>>> I read through the Cookbook carefully, especially chapter 9.13 "Specifying pen attributes" and 9.14 "Specifying area fill attributes", but there seems to be no "official" way of achieving this. 
>>>> 
>>>> I thought about shrinking the polygon a little bit and fill the developing  gap via -Gp. However, this would lead to a variable width pattern due to projection distortion. 
>>>> 
>>>> Looking into the -t option (PDF transparency), I thought about replacing the pattern with a solid line of large width and some added transparency to achieve a similar result. So far I was unable to confine the line to the inside of the polygon. 
>>>> 
>>>> Any ideas are highly welcome. 
>>>> 
>>>> All the best,
>>>> Kristof
>>>> 
>>>> To unsubscribe, send the message "signoff gmt-help" to [email protected]
>>> 
>>> To unsubscribe, send the message "signoff gmt-help" to [email protected]
>> 
>> To unsubscribe, send the message "signoff gmt-help" to [email protected]
> 
> To unsubscribe, send the message "signoff gmt-help" to [email protected]


--
My PGP Public Key: http://kristofkoch.de/pgp/


To unsubscribe, send the message "signoff gmt-help" to [email protected]
signature.asc (application/pgp-signature, 496 B)
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQEcBAEBCgAGBQJTFBlZAAoJEJ3YS27/3eKHPGAH/iyyC42LpvWDDBksYHo9u5oZ
s+1MysKUqnscQ1Gad5PuLbsevyMT9UvZMXPtCG7EJyyF/Kk2DDqy6r0e8FrQcHYV
jYyBGTbvQCgvdK3OKXtiCpKkeLnMWjoANV/+MtNEn/HGHutocRmpWoElW7SzfXLM
rk9atcrzOPtLnH98xEGySHWZGr50JY88XChEmZTkbGi4SC/kBAbRejngLBK2kfHd
X+Bv1mcCCAf/VRoz4WNlFbvmXKMBAysPw5b+Fz9jl3O/JE2oG+uVjKiUS55wFSJS
EC3hnKGCwm2mBH+7ONyaqZPDD86yO2TpOmHFRVR4QWs9OyLffrrE8CPg4r4kAaE=
=g5rL
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.