polygon

r stat_contour incorrect fill with polygon

╄→尐↘猪︶ㄣ 提交于 2019-11-30 17:27:33
问题 When I use stat_contour with polygon, some regions should not be filled because there is no data there, i marked them in the figure. Does anyone know how to avoid that? In addition, there is space between axis and plot region, how to remove it?! Here is the plotting code: plot_contour <- function (da, native ) { h2d<-hist2d(da$germ_div,da[[native]],nbins=40,show=F) h2d$counts<-h2d$counts+1 counts<-log(h2d$counts, base=10) rownames(counts)<-h2d$x colnames(counts)<-h2d$y counts<-melt(counts)

Drawing an empty polygon given a set of points on a Map Overylay (Android 2.1)

夙愿已清 提交于 2019-11-30 16:48:08
I've set of n points and I want to draw a n-sided polygon using these points. I tried using android.graphics.path (please see below). Path path = new Path(); Vertex currVtx; for (int j = 0; j < vertices.size(); j++) { currVtx = vertices.get(j); if (!currVtx.hasLatLong()) continue; Point currentScreenPoint = getScreenPointFromGeoPoint( currVtx, mapview); if (j == 0) path.moveTo(currentScreenPoint.x, currentScreenPoint.y); // vertex. else path.lineTo(currentScreenPoint.x, currentScreenPoint.y); } Currently I'm getting a solid (filled with the color of the canvas) polygon with this code. Is there

Convert a shapefile from polygons to points? [closed]

依然范特西╮ 提交于 2019-11-30 16:24:38
I have a non-overlapping polygon-based shapefile (.shp) with a large spatial extent and many dozens of associated attributes. The shapefile is projected in UTMs. I would like to convert the polygons to points spaced out in a 30-m resolution grid, in which each point would retain the attributes of the polygon it is located within. Output would simply be a table of the points: X, Y, attribute1, attribute2, attribute 3,etc... I would ideally like to do this operation in R, or (less ideally) some other free program I can run on a Mac. NOTE: I'm throwing this up in part to learn whether there's a

Displaying a polygon with gmaps4rails

痴心易碎 提交于 2019-11-30 16:03:17
Ruby noob here. Trying to display a list of points as a polygon on a google map using the gmaps4rails gem (awesome gem by the way). Any suggestions based on code sample below would be much appreciated! I can see the outline for the map, but no map and no polygon. Update: this code has been updated and the problem is solved. Class Schoolpoint is a list of lat/long pairs that belong to School In my controller: @polyjson = [] schoolpoints = [] Schoolpoint.where(:school_id => params[:id]).each do |point| schoolpoints << { :lng => point.longitude, :lat => point.latitude} end @polyjson =

How to represent a polygon with hole(s)?

杀马特。学长 韩版系。学妹 提交于 2019-11-30 15:20:31
问题 It's usually popular to work with polygons with their vertices sorted CW or CCW in vectors(2*1 or 1*2 matrices). However, how to state polygons with holes in vectors? I'm going to apply various process on these polygons, so I want a way of representing with which I could work easily or efficiently.(i.e how to state that kind of polygons in my program in order to ease my algorithms?) polygons are 2D and I'm programming in MATLAB. EDIT 1 : I'm going to calculate visibility graph of these

Polygon Intersection with Line | Python Shapely

≯℡__Kan透↙ 提交于 2019-11-30 15:02:09
问题 I have been trying to use shapely to find the intersection of a line and a polygon, but I'm having issues with some floating point numbers. Example code: polygon = [(4.0, -2.0), (5.0, -2.0), (4.0, -3.0), (3.0, -3.0), (4.0, -2.0)] shapely_poly = shapely.geometry.Polygon(polygon) line = [(4.0, -2.0000000000000004), (2.0, -1.1102230246251565e-15)] shapely_line = shapely.geometry.LineString(line) intersection_line = list(shapely_poly.intersection(shapely_line).coords) print intersection_line What

draw a smooth polygon around data points in a scatter plot, in matplotlib

别说谁变了你拦得住时间么 提交于 2019-11-30 14:54:30
I have a bunch of cross plots with two sets of data and have been looking for a matploltib way of highlighting their plotted regions with smoothed polygon outlines. At the moment i just use Adobe Illustrator and amend saved plot, but this is not ideal. Example: I'd be grateful for any pointers/links to examples. Cheers Pablo Here, you have an example. I was written the main ideas, but obviously, you could do it better. A short explanations: 1) You need to compute the convex-hull ( http://en.wikipedia.org/wiki/Convex_hull ) 2) With the hull, you could scale it to keep all your data inside. 3)

Drag (move) a polygon using Google Maps v3

我怕爱的太早我们不能终老 提交于 2019-11-30 14:02:10
The Google Maps API for a Polygon does not offer a drag method. What would be an efficient way of implementing such a feature (i.e., sufficiently optimised so that it would not kill a four year old laptop)? Thank you! I found the Google Maps V2 Polygon Implementation to be very limiting for the needs I have had and solved it by creating a custom overlay. My group is currently stuck on IE6 so I have yet to migrate over to Google Maps V3 - but taking a quick look at the API shows that you could probably do a similar thing that I did in V2 with V3. Essentially the idea is: Create a Custom Overlay

How can I avoid polygon edge stitching artifacts in HTML5 Canvas?

五迷三道 提交于 2019-11-30 14:01:17
I maintain parallel Flash and HTML5/Canvas renderers for the OpenHeatMap open-source project. I'm plagued by an inconsistency in the rendering of filled polygons with fractional coordinates between the two versions. If you render two polygons that share an edge, Canvas will show a visible join along that edge, whereas Flash will seamlessly meld the two together, with no difference visible if they're the same color. I've put together a minimal page here to show the issue: http://web.mailana.com/labs/stitchingbug/ [Gak, spam prevention stops this from being an image, but see here for a

How to represent a polygon with hole(s)?

南笙酒味 提交于 2019-11-30 14:00:41
It's usually popular to work with polygons with their vertices sorted CW or CCW in vectors(2*1 or 1*2 matrices). However, how to state polygons with holes in vectors? I'm going to apply various process on these polygons, so I want a way of representing with which I could work easily or efficiently.(i.e how to state that kind of polygons in my program in order to ease my algorithms?) polygons are 2D and I'm programming in MATLAB. EDIT 1 : I'm going to calculate visibility graph of these polygons(with or without holes). Jason S As others have mentioned, a polygon with holes can be represented as