Created
June 10, 2019 19:46
-
-
Save jimcrozier/6644bd4472e719e37f2c342cb3b5f9db to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(ggplot) | |
library(plotly) | |
#fake data | |
dat = data.frame(x = c(1,2,3), rev = c(10,20,30), upper = c(15,25,35), lower = c(5,15,25)) | |
#create a plot | |
p1 = dat %>% | |
ggplot(aes(x = x, | |
y=rev,ymin=lower,ymax=upper)) + | |
geom_pointrange(size=2) + | |
scale_size_area() + | |
xlab("Average Price") + | |
coord_cartesian(ylim = c(min(0,dat$rev)*1.2, max(dat$rev)*1.2)) + | |
ylab(stringr::str_to_title(item)) + | |
ggtitle(paste0("Revenue by Pricing Group ")) + | |
labs( colour="Algorithm", | |
subtitle = paste("I'm on a boat")) + | |
theme(legend.position="none") | |
#look at plot, base R | |
p1 | |
#render in plotly | |
plotly::ggplotly(p1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment