Dynamic data visualizations in R
Dynamic data visualizations in R, Plot.ly specializes in dynamic data visualizations online and has a particular aptitude for translating R, Python, and other data processing tools’ code to produce data graphics.
The plotly.js javascript library, which is open source and used in this project, is the foundation for it. The plotly package in R provides access to the functionality of plot.ly.
Plotly is particularly appealing since it can use the ggplotly method to turn any ggplot2 object into a plotly object.
This makes current data visuals instantly interactive. Automatic features include mouse-over annotations and brushing.
For instance, we show a static graphic of the frequency of the names of the four Beatles members through time in the United States.
library(mdsr)
library(babynames)
library(dplyr)
library(ggplot2)
babynames<-data.frame(babynames)
Beatles<-subset(babynames, babynames$name==c("Mary","Anna","Elizabeth","Ringo"))
beatles_plot<-ggplot(data=Beatles,aes(x=year,y=n))+
geom_line(aes(color=name),size=2)
beatles_plot
Following the application of the ggplotly() function, a plot is shown in R Studio or in a web browser.
library(plotly)
ggplotly(beatles_plot)
How Do Machine Learning Chatbots Work – Data Science Tutorials
Upcoming post we will discuss how to create interactive graphics for exploratory data analysis.
Keep Reading & Keep Learning!