Testing Entry with R Rmarkdown File

(This article was first published on R on Chi's Impe[r]fect Blog, and kindly contributed to R-bloggers)

Hello! World!

Just figuring out how the blog post works with this random set of coffee data!

Espresso Drinks Visualized with ggplot2 Pie Chart

Pie chart can be created with using polar coordinate.

## Pie Chart
coffee_long  %>% ggplot() +
  geom_bar(aes(x=sqrt(total.amount)/2, y = amount, 
               fill=fct_rev(ingredient.f), width=sqrt(total.amount)), 
           stat="identity", position="fill") + 
  facet_wrap(~name2, ncol=4) +
  geom_text(aes(x=sqrt(total.amount), y=Inf, label=""), size=7) +
  theme_void(base_family="Roboto Condensed") +
  coord_polar(theta="y") +
  scale_fill_hue(name="Ingredient", l=80) +
  theme(legend.position="top")

Espresso Drinks Visualized with ggplot2 Bar Chart

## Bar Chart

coffee_long  %>% ggplot() +
  geom_bar(aes(x=3, y = amount, fill=fct_rev(ingredient.f), width=sqrt(total.amount)/2),
           stat="identity", position="stack") + 
  facet_wrap(~name2, ncol=4) +
  theme_void(base_family="Roboto Condensed") +
  scale_fill_hue(name="Ingredient", l=80) +
  theme(legend.position="top")

To leave a comment for the author, please follow the link and comment on their blog: R on Chi's Impe[r]fect Blog.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)