Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. library("ggplot2)
  2. library("plotly")
  3. test_data <- data.frame(A = c(1,5,7,4,2),
  4. B = c(3,3,6,8,4),
  5. C = c(6,2,9,4,5))
  6.  
  7. my_dates <- as.Date(c("2010-01-01", "2010-02-01",
  8. "2010-03-01", "2010- 4-01",
  9. "2010-05-01"))
  10.  
  11. xts_data <- xts(test_data, order.by = my_dates)
  12. p <- autoplot(xts_data, facets = NULL) +
  13. guides(color = guide_legend(override.aes = list(size = 2))) +
  14. geom_line(size = 1)
  15. print(ggplotly(p))
  16.  
  17. new_df <- data.frame(P = c(70, 70, 70),
  18. Category = c("A", "B", "C"),
  19. Value = c(5, 15, 10))
  20. p <- ggplot(data = new_df, aes(
  21. x = Category, y = Value)) +
  22. geom_bar(position = position_dodge(), stat = "identity")
  23. print(p)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement