Quantcast
Channel: Plot two graphs in a same plot - Stack Overflow
Viewing all articles
Browse latest Browse all 18

Answer by Mateo Sanchez for Plot two graphs in a same plot

$
0
0

You could use the ggplotly() function from the plotly package to turn any of the gggplot2 examples here into an interactive plot, but I think this sort of plot is better without ggplot2:

# call Plotly and enter username and keylibrary(plotly)x  <- seq(-2, 2, 0.05)y1 <- pnorm(x)y2 <- pnorm(x, 1, 1)plot_ly(x = x) %>%  add_lines(y = y1, color = I("red"), name = "Red") %>%  add_lines(y = y2, color = I("green"), name = "Green")

enter image description here


Viewing all articles
Browse latest Browse all 18

Trending Articles