I want to visualize an x-y scatter in 3d, using the density/overlaps as z values. I guess this would be like using alpha as a z-axis - more overlap = higher z. Suggestions? Perhaps using cloud() in lattice library?
I use rgl for 3D visualization. You can rotate the image in rgl window using your mouse. Wheel zooms in/out.
example(plot3d)
rgl.bg(color = "black") # Space, the final Frontier.
There are a variety of 2d density functions available:
MASS::kde2d
fields::smooth.2d
hexbin::hexbin
In general visualizing 3d clouds of points is rather difficult. Pseudo 3d with surfaces is ok but the points do not display with sufficient depth cues. If you really want to try it, then use the rgl package so you can rotate.
Related
I want to plot the recorded path of an object such as a plane or drone in 3d space using R. The plotted path should be represented by a flat “ribbon” whose orientation perpendicular to the direction of travel changes to reflect the roll of the object. In other words, I want to be able to visualize the path and orientation of the object in one "ribbon" as it banks in turns.
As far as as I can tell, a traditional ribbon plot in R won't allow you to change the orientation in a third dimension.
Matlab and Python have functionality for creating quiver plots where arrows may be placed to indicate the xyz orientation of the object at a given point in time along the path. I cannot find any R packages with similar functionality.
I have played with Plot3D, Plotrgl, Plot3Drgl and cannot find a package that has this capability.
Q1: Are there any packages in R that would support this type of plot?
Q2: If there isn't, how can I go about creating this type of plot R?
Below are examples in Python and Matlab for the 3D quiver type plots, as well as an image demonstrating the ribbon concept I am imagining.
https://medium.com/analytics-vidhya/exploring-data-acquisition-and-trajectory-tracking-with-android-devices-and-python-9fdef38f25ee
Example of 3D quiver plot in python
https://github.com/xioTechnologies/Gait-Tracking-With-x-IMU
Example of 3D quiver plot in matlab
This is an example of what the "ribbon" would look like
Thanks for any help!
I'm trying to plot igraph objects for which I have set the xy coordinates.
It's been working fine, but when the plot is produced it is stretched in either the x or y so the network looks distorted.
Does anyone know a way that I can define the plotting area (i.e. tell igraph that I want it to plot on a square of set dimensions)? Or any other way of avoiding this problem?
I drew a 3D scatterplot in R which is a flat surface.
But the plot does not clearly show what it looks like, so I'd like to change the angle to see this plot at a different viewpoint.
How can I do this?
I want to plot a point in the polar coordinate system using SAGE. For instance the given is cis 135°. Can somebody tell me what are the commands for this to be done?
Unfortunately it seems that the polar plotting facility and point plotting don't play well (though there is a polar_plot command if you have a function to plot). This seems to work but you might not like it so much; I would recommend turning this into a function if you have a lot to plot.
angle = 135
true_angle = 135/180*pi
point([cos(true_angle),sin(true_angle)],color='red')
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