Plotly 3d:
p <- plot_ly(data=mtcars, x=~disp, y=~cyl,z=~mpg, name="MPG",
width=720, height=550)
p <- p %>% add_markers()
p <- p %>% layout(scene=list(xaxis=list(title='Displacement in^3'),
yaxis=list(title='Cylinders'),
zaxis=list(title='MPG')), paper_bgcolor='transparent')
p
ggplot2 Single Regression:
ggplot(data=mtcars, aes(x=disp, y=hp)) + geom_point() + geom_smooth(method=lm, se=FALSE)
ggplot2 Multi Regression:
mtcars$cyl <- as.factor(mtcars$cyl)
ggplot(data=mtcars, aes(x=disp, y=hp, shape=cyl, color=cyl)) + geom_point() +
geom_smooth(method=lm, se=FALSE, fullrange=TRUE)