Power BI Visualization & R : 3D ScatterPlot with Interactive Rotation View by R Script Visual

 


In the video. I have shared the method on using R script visual with package scatterplot3d to generate a 3D scatter plot, and also introduce a way on adding dynamic viewing angles to  rotate the 3D plot with slicer visual based on power BI new parameter feature generated angle value table . In the demo we applied power query editor to prepare source data table for the 3D plot, used the R studio to cerate and edit R script for 3d scatter plot and finally adopt the slicer visual generate by Power BI new parameter for interactive rotating 3D graphic view angels dynamically. Hope the video give some helps for your power BI project developments. 



R Scripts:


# Load the scatterplot3d library:
library(scatterplot3d)

# Define variables from the source data for plotting:
x <- dataset$"Technical Skills"
y <- dataset$"Leadership & Management"
z <- dataset$"Personal Development"
l <- dataset$"Employee ID"

# apply scattedplot3d function to create the 3D scatter plot:
scatter3d <- scatterplot3d(x,y,z,
                           main = "3D Scatter Plot for Employee Skills Evaluations",
                           color = dataset$Index,
                           pch = 16,
                           type ="h",
                           xlab = "Tech Skills",
                           ylab = "Lead & Magt",
                           zlab = "Personal Devel",
                           angle = dataset$Angles[1],
                           cex.axis = 1.3,
                           col.axis = "darkgray",
                           cex.lab = 1.5,
                           col.lab = "darkblue"
                           )

# Convert 3D coordinates and add labels with colour to each employee point in the plot:
scatter3d.coords <- scatter3d$xyz.convert(x,y,z)
text(scatter3d.coords$x,
     scatter3d.coords$y,
     labels = l,
     cex =1,
     pos = 4,
     col = "blue")


References:


R scatterplot3d package descriptions: 

https://cran.r-project.org/web/packages/scatterplot3d/scatterplot3d.pdf






Comments

Popular posts from this blog

Power BI DAX Formula for Dynamic Ranking Calculations Based on User Selections and Filters

Power BI DAX and Visualizations: Active employees across time (as x-axis) by Tenure group or age group

Excel VBA Tips: A Macro to Generate Line Chart Dynamically for Loan Schedule Trend Report