Back to Browse

Introduction to the plotly Package in R (Example) | Draw Interactive Plots | Create Web-Based Graphs

6.5K views
Dec 1, 2021
11:26

How to use the plotly package as an alternative graphing library to ggplot2 using JavaScript to render the final graphics in the R programming language. More details: https://statisticsglobe.com/plotly-r-package R code of this video: df <- mtcars df$name <- row.names(mtcars) install.packages("plotly") library(plotly) plot_ly( data = df, x = ~cyl, y = ~disp ) plot_ly( data = df, x = ~cyl, y = ~disp, type = "scatter", mode = "markers" ) plot_ly( data = df, x = ~cyl, y = ~disp, color = ~factor(cyl), type = "scatter", mode = "markers" ) plot_ly( data = df, x = ~cyl, y = ~disp, color = ~factor(cyl), text = ~name, type = "scatter", mode = "markers" ) fig <- ggplot2::ggplot(data = df, aes(x=cyl, y=disp)) + geom_point(aes(color = factor(cyl))) ggplotly(fig) Follow me on Social Media: Facebook – Statistics Globe Page: https://www.facebook.com/statisticsglobecom/ Facebook – Group for Discussions & Questions: https://www.facebook.com/groups/statisticsglobe LinkedIn – Statistics Globe Page: https://www.linkedin.com/company/statisticsglobe/ LinkedIn – Group for Discussions & Questions: https://www.linkedin.com/groups/12555223/ Twitter: https://twitter.com/JoachimSchork

Download

1 formats

Video Formats

360pmp421.9 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Introduction to the plotly Package in R (Example) | Draw Interactive Plots | Create Web-Based Graphs | NatokHD