| install.packages(“plotly”) |
|---|
| title: “Vehicle Performance Analysis” author: “Kapil Maraj” date: “June 15, 2026” output: ioslides_presentation |
This interactive presentation explores performance variables from the
historic mtcars dataset.
# Prepare the dataset safely without using dollar signs
plot_data <- mtcars
plot_data['am'] <- factor(plot_data[['am']], labels = c("Automatic", "Manual"))
plot_data['cyl'] <- factor(plot_data[['cyl']], labels = c("4 Cylinders", "6 Cylinders", "8 Cylinders"))
# Build the interactive 3D scatter plot
plot_ly(
data = plot_data,
x = ~wt,
y = ~hp,
z = ~mpg,
color = ~cyl,
colors = c('#1f77b4', '#ff7f0e', '#2ca02c'),
text = ~paste("Transmission:", am),
type = "scatter3d",
mode = "markers",
marker = list(size = 6, opacity = 0.8, line = list(color = '#ffffff', width = 1))
) %>%
layout(
scene = list(
xaxis = list(title = 'Weight (1000 lbs)'),
yaxis = list(title = 'Gross Horsepower'),
zaxis = list(title = 'Fuel Efficiency (MPG)')
),
title = "Engine Power & Weight vs. Efficiency"
)