5 dimensional plot in r -


I am trying to make a 5-dimensional plot in R. I am currently using the rgl package to plot my data in 4 dimensions, using 3 variables in the form of X, Y, Z, another variable in the form of color Can be used. I am thinking that I can add the fifth variable using this package, like the size or size of the size in the space. Here is an example of my data, and my current code:

  set.seed (1) df & lt; - data.frame (repeat (4, sample (1: 200,1000, rep = lt; - cbind (df, addme) colnames (df) <- c ("correct" Var1 "," var2 "," var3 "," var4 "," var5 ") are required (rgl) plot3d (df $ var1, df $ var2, df $ var3, col = as.numeric (df $ var4), size = 0.5, type = 's I hope this 5th dimension is possible. Thanks a lot,     

Here is a ggplot2 option I usually want to stay away from 3D plots because They are difficult to interpret properly. I will not put in about 5 continuous variables in the same way as I have ... < P> Enter image details here

Though this is a bit confusing, you can Really read all 5 dimensions for most points.

A better approach opens for creating multi-dimensional conspiracies. If some of your variables are clear, if all of your variables are constant, then you clear some of them with cut And then use the facet_wrap or facet_grid to plot them.

For example, here I break var3 and var4 in quintiles and use them on facet_grid . Note that I also keep colorful aesthetics and show that for most of the time, high-dimensional plots are enough to achieve significant points pointing to a continuous variable (here you will see that the fill and border color are beautiful Uniforms in any given grid cell):

  df $ var4.cat & lt; - Include cut (df $ var4, quantity (df $ var4, (0: ​​5) / 5). = T) DF $ var3.cat & lt; - Include Cut (df $ var3, Quantity (DF $ var3, (0: ​​5) / 5). Lowest = T) ggplot (df, aes (x = var1, y = var2, fill = var3, color) + var4, size = var5 ^ 2)) + geom_point (size = 21) + scale_color_gradient (lower = "red", high = "green") + scale_size_continuous (range = c (1,12)) + facet_grid (var3.cat ~ Var4.cat)   

Enter image details here

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -