I have 2 sets of data for 3D plot. First is defined on scattered grid and consist of X-,Y-,Z-vector, the second is defined on structured grid, consist of X-,Y-,Z-matrix and is obtained by interpolation of the first.
How do I plot surface of the second and points of the first inside of one 3d plot?
There are many solutions on the web, such as:
http://digital.ni.com/public.nsf/allkb/0ABACC8B023C15D3862572ED0070E4A6
https://decibel.ni.com/content/docs/DOC-4271
https://decibel.ni.com/content/docs/DOC-4585
You can go over and find the one which matches to your problem
Related
I have gone through few tutorials and answers here in stackoverflow such as:
Overlap image plot on a Google Map background in R or
Plotting contours on an irregular grid or Geographical heat map of a custom property in R with ggmap or How to overlay global map on filled contour in R language or https://blog.dominodatalab.com/geographic-visualization-with-rs-ggmaps/
They either don't serve my purpose or consider the density of the data to create the image.
I am looking for a way to plot contour on a map of a certain data, and would expect the image to look something like this:
or something like this taken from https://dsparks.wordpress.com/2012/07/18/mapping-public-opinion-a-tutorial/:
I have a data here that gives a contour plot like this in plot_ly but i want this over the map given by latitudes and longitudes.
Please guide me on how this can be done. Any links to potential answers or codes would be helpful.
Ok I did some digging and figured that to plot the data -which in this case are point values randomly distributed across the Latitude and Longitude, one has to make it continuous instead of the discreetly distributed one. To do this I interpolated the data to fill in the gaps, this method is given in Plotting contours on an irregular grid and then take it from there. Now the interpolation here is done using a linear regression, one can use other methods such as IDW, Kriging, Nearest Neighbourhood etc for which R-packages are easily available. These methods are widely used in climatology and topographic analysis. To read more about interpolation methods see this paper.
I'm unable to find any R data sets simply representing shapes in 3-space. For instance, I would like a sample data sets of points for a torus in 3-space so that I can use persp for showing a surface plot and then use a Sammon mapping to 2-space and show another plot and investigate the structure preserving properties of Sammon mappings.
I used hclust on my data and got a two-cluster solution. Then I used the scatter3d() to create a 3D scatterplot to visualize the two clusters by getting x, y,z coordinates multidemsional scaling (see below).
I am wondering how can I define and draw a linear discrminant hyperplane that separate these two clusters.
The most useful and sensible answer to the first part of my question can be found here:
https://stat.ethz.ch/pipermail/r-help/2010-May/239195.html
For the second part, I think surface3d() will do the trick.
I have a dense scatter plot on a map (produced using Python, matplotlib, and basemap). Here is a part of the image:
I'd like to solve the overlap problem. I think the way to do this is to combine this simple lat/lon coordinate mapping with the technique I often see implemented in those "spring-loaded" network (social, not computer) graphs.
Is there a simple existing algorithm to auto-magically move these points so that they are not overlapping? If so, I can easily than add a small line from each point to its the correct lat/lon coordinate where it is currently located.
Note: Hexbin and heatmap is not a solution since the discrete values are important and should not be compromised.
I just discovered ggmap and I've been playing around with plotting earthquake data from the USGS. I get the data in the form of Lat and Lon, depth and magnitude. I can easily plot the earthquakes as points with different colors based on depth but what I would like to do is take that depth data (just a single number) and generate contours to overlay on the map.
This seems like it should be MUCH more simple than the "Houston Crime" example I keep coming up on since I'm not doing any statistical "density" calculation or anything like that. Basically it's just a contour map on top of the google map of an area.
How do I do this (Presumably) simple, simple thing?
Thanks!
The problem of plotting a 3D surface using only a small sample of unequally spaced lat/long points and a height z (or equivalent) variable is non-trivial -- you have to estimate the values of z for all of the lat-long grid coordinates you do not have, for example using loess() or kriging to create a smooth surface.
Take a look at Methods for doing heatmaps, level / contour plots, and hexagonal binning, case #5. For a geoR example see http://www4.stat.ncsu.edu/~reich/CUSP/Ordinary_Kriging_in_R.pdf