library(ggplot2)
library(plotly)

Scatterplot diamonds data set add carat-price, factory by cut

plot_ly(diamonds, x = ~carat, y = ~price, type = "scatter", 
    color = ~factor(cut))

Continuous Color- diamonds- carat-price factor by continuous depth varialble

plot_ly(diamonds, x = ~carat, y = ~price, type = "scatter", 
    color = ~depth)

Diamonds dataset using X as sizing factor

plot_ly(diamonds, x = ~carat, y = ~price, type = "scatter", 
    color = ~factor(cut), size = ~x)

Multi Line Graph

library(plotly)
library(tidyr)
library(dplyr)

plot_ly(diamonds, x = ~cut, y = ~carat, color = ~color, 
    type = "scatter", mode = "lines")

Histogram

plot_ly(x = ~diamonds$depth, type = "histogram")