s-news
[Top] [All Lists]

[S] Summary: Clipping polygons

To: s-news@wubios.wustl.edu
Subject: [S] Summary: Clipping polygons
From: Megan Pledger <m.pledger@ctru.auckland.ac.nz>
Date: Mon, 01 Nov 1999 14:37:17 +1300
Sender: owner-s-news@wubios.wustl.edu
My original problem was that different versions of Splus would either 
a) have a shaded polygon being bounded by the plot area or
b) not be bounded by the plot area e.g. the polygon would be drawn in the
title/label areas.

For the work I was doing I preferred the latter.

Thanks to Joel Dubin who supplied an answer to get around this. He wrote:
>       I just had this 'polygon' issue come up recently.  My workaround
> was to output the polygon graph to a postscript device (i.e., a postscript
> file), which indeed only printed the polygons in the graphic region I
> prespecified in plot(x,y, xlim=c(,), ylim=c(,), type='n') with xlim and
> ylim completed as desired.
>
>      I am using S-Plus version 4.5 on Windows.  I don't know
>  if this will work this way for all versions and platforms.

It also works for the UNIX version of Splus 3.4 and 5.1

However since I was also interested graph output to Power Point (i.e. *.wmf
files, not *.ps) I wrote a function to clip/bound polygons (or, more
strictly, clip/bound parallelograms defined by four points). The clipping
function suits my needs but is not "industrial strength" so I won't post it
here.


In my original message I wrote:
> In a win3.1 version of S-Plus v3.2 I had a function that added 
> polygons to a graph. Where parts of the polygon fell outside 
> the graph area then those parts would not be drawn i.e. the 
> polygon was being clipped by the graph area.
>
>  The same function in S-Plus v3.4, 5.1 for Solaris and 4.5 for
> Windows adds polygons to the graph but also draws those parts 
> of the polygon that falls outside of the graph area i.e. in the
> space for labels and titles.
>
>  I would really like the former rather than the latter i.e. the 
> polygons to be clipped by the graph area. Is there  some 
> function/variable that turns "clipping" on and off? 
> (I really, really, really don't want to have to right a clipping 
> function myself.)
>
> The point of all this is to shade the area in a gam.plot between
> the lower and upper standard error curves when the dependent variable
> has been restricted to a smaller interval by xlim. I chose to do it 
> using polygon. Is there an easier way which would make my problem above 
> redundant?

Megan

--
Megan Pledger,                        m.pledger@fred.auckland.ac.nz 
Biostatistician,                      http://www.ctru.auckland.ac.nz
Clinical Trials Research Unit,        tel: +64 9 373 7599 4766
University of Auckland,               fax: +64 9 373 1710
Auckland, New Zealand.

  
 
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>
  • [S] Summary: Clipping polygons, Megan Pledger <=