Displaying 20 results from an estimated 4000 matches similar to: "Identify points that lie within polygon"
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 =
2012 Nov 26
3
Passing lists between functions
I'd like to pass a list object created by one function as an argument of
another function. once inside the second function, I'd like to break the
list up to it's individual elements, each then identifiable by the 'names'
of the list.
The list looks something like
lst<-list(a=1, b=2, df=5, g=7)
then inside the function I've been writing a sequence of statements that
2012 Feb 09
1
Row-wise kronecker product with Matrix package
I'm trying to calculate the row-wise kronecker product A \Box B of two
sparse matrices A and B, and am struggling to find a quick way to do this
that takes advantage of sparseness. I thought a good idea would be to use
"rep" to construct 2 matrices of the same dimension of the end product, and
multiply these two together:
library(Matrix)
A<-Matrix(c(1,0,0,0,0,1,2,0), 2, 4)
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
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 =
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
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
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
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 =
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
2007 Sep 26
1
Area of overlap between polygon and circle
R-listers,
Given a polygon and a circle defined by its center coordinates and a
radius, I would like to calculate the area of overlap. I know that I
can create a polygon from the circle and then use available packages to
get the area of the intersection. However, because the polygon is of a
fixed size and I will be doing this for circles of varying sizes, I'm
concerned about
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
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
2004 Apr 20
2
polygon
Dear all
In order to clearly mark values wich are larger than a treshold value, I
would like to color the surface below the line given by plot (yy~xx). To
color is only the surface between abline (treshold) and yy if they are
larger than the specific limit. I guess I can use the function polygon,
but I can not find any valuable solution.
I'm grateful to you for an advice or an example.
2006 Apr 26
1
Polygon-like interactive selection of plotted points
[Please CC me for all replies, since I am not currently subscribed to
the list.]
Hi all,
I have the following problem/question: Imagine you have a two-
dimensional plot, and you want to select a number of points, around
which you could draw a polygon. The points of the polygon are defined
by clicking in the graphics window (locator()/identify()), all points
inside the polygon are
2004 Jun 14
2
ordering points as vertex of a polygon
Dear R-users,
Suppose I have the following x-y coordinates which give the boundaries of
a polygon:
> x <- c(5,4,5,9,6,6,4,7,10,7,10,4,10)
> y <- c(6,3,2,6,3,7,5,4,4,7, 5,4, 6)
I would like to plot the following graph:
> plot(x,y)
> ord <- c(7,12,2,3,5,8,9,11,13,4,10,6,1)
> polygon(x[ord],y[ord])
How I can obtain the above ordering (in the example an anti-clockwise
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