Power BI Advanced Visual & R: Simulate 3D Quadratic Surface in R Script Visual
In the video I have shared the
detail steps and R script codes on creating 3D quadratic surface plot in power
BI desktop. With changing the 8 parameter slicers in power BI visual we are
able to simulate the different types of 3D quadratic surface with the View
Angels at the levels of Horizontal and Vertical. The R package Lattice and
function Wireframe are applied to plot the 3D quadratic Surface. The link of
the R script codes for the video I have attached in the video descriptions in
below. Hope this video brings some help for your project developments.
R Scripts for the demo:
# Load the lattice package:
library(lattice)
# Create Parameter Variable for rotating view angles
HAngles=dataset$H_Angle
VAngles=dataset$V_Angle
# Create coefficient Prameter Variables:
a = dataset$a
b = dataset$b
c = dataset$c
d = dataset$d
e = dataset$e
f = dataset$f
# Create data for a quadratic surface
x <- seq(-5, 5, length.out = 100)
y <- seq(-5, 5, length.out = 100)
# z <- outer(x, y, function(x, y) a*x^2 + b*y^2)
z <- outer(x, y, function(x, y) a*x^2 + b*y^2 + c*x*y + d*x + e*y+f)
# Create a wireframe plot of the quadratic surface
wireframe(z ~ x * y, data = expand.grid(x = x, y = y), color = "blue", drape = TRUE,
scales = list(arrows = FALSE),
main = "Quadratic Surface",
xlab = "X Axis",
ylab = "Y Axis",
zlab = "Z Axis",
screen = list(z = HAngles, x = -VAngles))
Comments
Post a Comment