3D radar chart in JavaScript - graph

Is there a JavaScript library that allows you to visualize Radar Chart (aka Spider Chart) in 3D form along with the rotation.
What I mean by that is to visualize this kind of chart in 3D by adding time as a coordinate. The end result will be a 3D sphere that is not symmetrically shaped. For example:
I tried to search all different 3D JavaScript libraries but was not able to find anything that will let me do it easily without creating it from scratch.

What about D3? There aren't many chart types that can't be visualized with it.
More information at GitHub and Wikipedia.

Related

Creating a 3D "ribbon" style plot in R

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!

R non gridded filled contour

I have a set of data that I'm trying to create a surface plot of. I have an x,y point and a to colour by.
I can create a xy plot with the points coloured but I can't find a way to create a surface plot with my data. The data isn't on a normal grid and I would prefer to not normalize it if possible (or I could just use a very fine grid).
The data won't be outside the a radius=1 circle so this part would need to be blank.
The code and the plot is shown below.
I've tried using contour, filled.contour as well as surface3d (not what I wanted). I'm not real familiar with many packages in R so I'm not even sure where to begin looking for this info.
Any help in creating this plot would be appreciated.
thanks,
Gordon
dip<-data.frame(dip=seq(0,90,10))
ddr<-data.frame(ddr=seq(0,350,10))
a<-merge(dip,ddr)
a$colour<-hsv(h=runif(nrow(a)))
degrees.to.radians<-function(degrees){
radians=degrees*pi/180
radians
}
a$equal_angle_x<-sin(degrees.to.radians(a$ddr))*tan(degrees.to.radians((90-a$dip)/2))
a$equal_angle_y<-cos(degrees.to.radians(a$ddr))*tan(degrees.to.radians((90-a$dip)/2))
plot(a$equal_angle_x,a$equal_angle_y,col=a$colour,lwd=10)
With regards to the plot I was trying to create is below. I believe the link in the first comment should get me where I'm trying to go.

Spacing of map scatter plot elements

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.

Network Graph and US Map in R

I created a network graph from data on flows between US states. For each vertex, I have the lat/long of the state.
I am hoping to recreate a network kind of graph that shows the edges, except that I set the location of each vertex to be their geographic position and have a state boundary map in the background.
I am using to igraph to create my network. There have been some cool mapping examples in ggplot2, so I am wondering if that is an option. I believe I have seen similar options using Pajek, but I am hoping to stay within R.
maps in ggplot2
Any ideas/insight would be appreciated.
Brock
You have multiple packages dealing with maps. The most easy is maps, which gives you the states map. You can plot the vertices over using the coordinates.
map("state")
points(longitute,latitude)
These plots can be manipulated and added to using the base tools, keeping in mind the x axis is the longitude and the y axis is the latitude. edges can be plotted using the segments() function.
In ggplot2 just use the map_data() function, which gives you the shape-data of the map, and the geom_polygon() to add it to the graph in whatever form you want. Again, you can add the vertices and edges using the coordinates with the appropriate ggplot2 function geom_point() and geom_segment(). The code you link at shows you how, or otherwise look at this for an example.
Next to that, you can take a look at the packages maptools, which offers more functionality and, mapproj, which allows for different projections of the same map. You can use these packages as well to calculate geographical distances in a coordinate system.
mapdata contains more databases, and covers basically the whole world. You can work with coordinates pretty nicely.

Combining 3D/2D plots

I'm trying to make a visualization that looks like this http://www.gradient-da.com/img/temperature%20surface%20plot%20470x406.JPG http://www.gradient-da.com/img/temperature%20surface%20plot%20470x406.JPG.
The idea is to have a 3D surface plot overlapping a 2d representation of a surface.
I can build arbitrary surfaces/polygon shapes (as in http://addictedtor.free.fr/graphiques/graphcode.php?graph=135 ) and I can make the respective 2D plot. What I don't seem to be able to figure out is the way to put them together in a nice way (like the one shown in the jpg above).
I've tried googling for the answer, but I wasn't able to find anything similar done in R.
Any help would be greatly appreciated!
EDIT: The 2D portion is not a projection of the 2D one. I chose this specific picture to illustrate this. For example
Here the 2D portion is the image of the circuit and on the 3D portion is the temperature).
In 2D you can have the map of a city and in 3D the traffic
etc...
Best,
Bruno
I will give a theoretical Idea,
In the same 3D plot, select a plane perpendicular to the 3D surface (just below the 3D-surface) and project all the values to it. Instead of 2D & 3D plot, you will use only a 3D plot, which also plots your surface.
HTH
It looks like the 2D plot is a layout of a microelectronic circuit, albeit with some detail skipped, and the 3D plot is perhaps a thermal plot of the same circuit.
I don't know enough about R's capabilities, but I imagine it would be easier to generate the two plots separately with R from the same dataset which represents the layout information (but with and without the thermal data) and then combine them with a graphics manipulation program.
No help in R, but you can do something similar in ROOT as seen in this image:
taken from the THistPainter class documentation.
The code is open source and could be examined if wanted for reimplementation.
Maybe you should try to make an opengl texture out of your 2d picture and map it on a 3d polygon to be included in your scenegraph?
Don't really understand if you wish to do it with R specifically, so maybe diving in opengl is a too low level for you. In case you'd be ready for that, you may reuse a simple java library that simplify plotting 3d surface: http://code.google.com/p/jzy3d
Hope that helps,
Martin
What you're looking for is called a texture map -- and if it's not provided in the R graphics package, you may be able to do it "by hand". The suggestion below may not be fast or convenient (or even helpful, as I'm not really familiar with R), but it may actually work...
Since you know you can draw a 3D surface plot with specified colors, you can try drawing a flat 3D surface using the colors of your image.
If R also lacks methods for extracting its data from image formats, there is an image format called PPM (standing for Portable PixMap), one variant of which is basically space-separated decimal numbers. After converting your image to this format (using Photoshop, say, or some dedicated image conversion program), it should be relatively easy to input into R.

Resources