Displaying 20 results from an estimated 10000 matches similar to: "erasing a polygon"
2010 Apr 08
2
erasing an area of a graph
I have a case where the easiest way to draw a particular symbol would be
to draw something a little bigger, and then use polygon(... , col=0) to
erase the extra stuff. Just how to do this best when par('bg') =
'transparent' is, however, eluding me. I've looked through the archives
and the book R Graphics without quite seeing the light.
Help or pointers to help would be
2002 Aug 06
1
polygon() draws non-transparent border, erase.screen draws non-transparent border (PR#1881)
# polygon ignores requests to have its border transparent, look at
par(bg="transparent")
plot(c(0, 3), 0:1)
polygon(c(0, 1, 1, 0), c(0, 0, 1, 1), border=NA, col = 0)
polygon(c(1, 2, 2, 1), c(0, 0, 1, 1), border="transparent", col = 0)
polygon(c(2, 3, 3, 2), c(0, 0, 1, 1), border=0, col = 0)
# a quick fix for erase.screen() is the following
erase.screen <-
function (n =
2008 Aug 28
4
Help with shading a polygon below a segment of a curve (normal distribution)
Dear R users,
I still feel new to R so please apologize if I am doing something stupid
here. My use of the polygon() function produces a result that I cannot
comprehend: In a plot, I would like to shade the area below a normal
distribution. However, I do not want the entire area to be shaded, but
just the area on the right side of a vertical line that I draw through
the distribution (in
2016 Apr 27
1
Determine if a set of x and y-latitude points are inside of a polygon using R
Objective: Determine if a set of x and y-latitude points are inside of
a polygon using R.
Lets say I have 9 polygons. Where I have labeled the polygons to be
checked from 1-9. The problem I?m running into is running the
point.in.polygon to check if those points are in one of several
polygons, as my code overwrites the result.
To accomplish this I am using the R-built in function called
2013 Sep 19
3
How do I ensure that the polygon in spatstat::owin(poly=<polygon>) does not have “negative area”
I am a new user of the R spatstat package and am having problems creating a
polygonal observation window with owin(). Code follows:
library("maps")
library ("sp")`
library("spatstat")
mass.map <- map("state", "massachusetts:main", fill=T) # This returns
a data frame includding x and y components that form a polygon of
massachusetts mainland`
2008 May 19
2
Draw Polygon with a Circular Side
Hello Friends!!!
I would want draw a circular histogram, and I would like draw a polygon with
a circular side. This is easy if I use the functions polygon and arc, but I
want that the polygon with a circular side have background colour. The
polygon created with function polygon can have background colour, but the
surface created with function arc can?t have background colour.
How I could create a
2011 Apr 08
4
Rpart decision tree
Dear useRs:
I try to plot an rpart object but cannot get a nice tree structure plot. I
am using plot.rpart and text.rpart (please see below) but the branches that
connect the nodes overlap the text in the ellipses and rectangles. Is there
a way to get a clean nice tree plot (as in the Rpart Mayo report)? I work
under Windows and use R2.11.1 with rpart version 3.1-46.
Thank you.
Tudor
...
2010 May 14
1
point.in.polygon() in sp package: accuracy problems?
Dear list:
I encountered some problems using the function point.in.polygon() of the sp package, when trying to determine whether some points lye inside, outside, on the border or on a vertice of a polygon.
I have a list of point I know should lye right on the border of a polygon, but some of them are not classified as such by point.in.polygon() (see the example code below).
To make a long story
2007 Aug 28
1
attempt at making a polygon class failed
I was reading a presentation of Professor Peng's and typed the
presentation code into R but I changed it to make plot.polygon a
separate function instread of defining the function in SetMethod itself
as he did. Is that the problem with the code below because
plot(p) just gives me zero. Thanks.
setClass("polygon", representation(x = "numeric",
y =
2016 Apr 28
0
polygon angle option perpendicular to axis
Tena koe Simon
plot(1:10, 1:10, type='n')
polygon(c(2,3,6,8), c(2,5,5,3), density=20, angle=90)
polygon(c(2,3,6,8), 5+c(2,5,5,3), density=20, angle=0)
I don't understand your problem. Perhaps if you "provide[d] commented, minimal, self-contained, reproducible code" it would help.
HTH ....
Peter Alspach
-----Original Message-----
From: R-help [mailto:r-help-bounces at
2016 Apr 28
1
polygon angle option perpendicular to axis
The angle is not based on the polygon edges, but it can seem that way if you do not use the asp=1 argument in your plot. Try this example,
> plot(1:10, 1:10, type='n')
> x <- c(1, 3, 5, 3)
> y <- c(3, 5, 3, 1)
> polygon(x, y, angle=0, density=10)
> polygon(x, y + 4.5, angle=45, density=10)
> polygon(x + 4.5, y + 4.5, angle=90, density=10)
> polygon(x + 4.5, y,
2016 Apr 28
1
polygon angle option perpendicular to axis
Thanks for the question. Here is a sample of the code for my plot:
Top = c(34, 39, 42, 45, 46, 41, 41, 40, 43, 38, 33, 33)
Bottom = c(24, 29, 32, 36, 32, 34, 32,41, 40, 39, 29, 24)
plot(1,1, col = "white", xlim = c(1.3,11.7), ylim = c(0,80), axis = FALSE, xaxt = "n")
axis(1, at = c(1:12))
polygon(c(c(1:12),c(12:1)), c(top, bottom), col =
2012 Aug 06
2
Identify points that lie within polygon
I have a complex 2D polygon with thousands of vertices, and I'd like to be
able to identify points from a large set contained within the polygon, and
was wondering if there might be an efficient way of doing this? Any advice
would be useful! Here is a small example of what I mean:
# make polygon
v1<-c(0,1,1,2,1,3,6,7)
v2<-c(1,3,3,5,6,7,8,9)
plot(v1, v2, type = "n" )
2007 Apr 30
1
intersect filled.contour and polygon
Dear R users;
Is there any way to intersect a filled contour image and a polygon? My
problem is that I want to create a kriging map and the boundaries of
my map are given by the coordinates of the polygon.
So far I can superompose the polygon in the filled.contour image but I
don't know how to get rid of the contour image outside of the polygon
boundaries.
Any hint will be appreciated
PM
2010 Aug 04
1
help with using grid.polygon()
Hi,
I'm trying to use grid.polygon() to plot several polygons at once, with a
view to putting coloured polygons beneath a curve. I'm struggling just to
get the grid.polygon to plot anything
# PLOT SOME POINTS
x <- 1:100
y <- 1:100*0.5 + 3
plot(x, y, pch = ".")
# PLOT 2 POLYGONS
library(grid)
grid.polygon(x = c(20, 20, 40, 40, 40, 40, 60, 60),
y =
2007 Dec 17
1
polygon class in splancs package
Dear forum,
I would like to use the kernel2d or spkernel2d in the Splancs-package, but
it does not recognize my polygon data.
"Error in kernel2d(as.points(ptsbin), polygonprov, h0 = 2, nx = 100, : " is
the error message.
Invalid poly argument
The data are defined as follows:
polgonprov<-list(x=polyprov$X, y=polyprov$Y) with X and Y coordinates in the
Lambert1972
2011 Dec 13
1
Re : Polygon
HI,
Sorry Carl, I received your message in my spam folder. Sarah proposed me a good example of code.
Thank you
Momadou
________________________________
De : Carl Witthoft [via R] <ml-node+s789695n4188375h96@n4.nabble.com>
Envoyé le : Mardi 13 Décembre 2011 3h34
Objet : Re: Polygon
Please read the posting guide and provide a (small) reproducible example
of your data.
The statement
2016 Apr 28
0
polygon angle option perpendicular to axis
Filling polygons with lines is a throwback to the time when the height
of quality graphics was the mechanical pen plotter (a device that used
a pen in a mechanical arm to draw the plot on a piece of paper).
Computing and printing technology has advanced quite a bit from that
day, so you may want to reconsider why you want polygons filled with
lines instead of just a solid color (and I consider
2008 Feb 25
1
color area between two time-series via polygon()?
Hi all,
I would like to color the area between two time-series. I tried it by
using the polygon() function but I keeps drawing lines between beginning
and end points.
Is there another more appropriate function or how could I close the
polygon at the end en the beginning of the time series (e.g., drawing a
straight line)?
The following doesn't plot a polygon between the two
2004 Dec 10
1
Adding a polygon to a time series plot
Preamble: Sorry for being dense.
Now that that's done, here are my questions.
I want to put a polygon on a plot of a time series. I'm going to add lines
from a smooth.spline interpolation and other annotation to it. But here's
the general idea:
# Start code
n <- 121
dat <- rnorm(n)
plot(dat, type="n")
polygon(c(1:n,n:1), c(dat,c(rep(0,n))), col =