Articles by R on Chi's Impe[r]fect Blog

Built-in Colour Names in R

September 7, 2019 | R on Chi's Impe[r]fect Blog

Quite often when you just want to whip out some quick plots, I like to assign the colours by colour names. Some of my go-to colours are… tomato,darkorange,turquioise,darkgrey,lightgrey. Recently I realized that I can get all of built-in colour names available in R to use by ...
[Read more...]

Playing Around with Phyllotactic Spirals

January 28, 2019 | R on Chi's Impe[r]fect Blog

I wanted to figure out how to create gif animation using the magick, so I decided I’ll try that out with ggplot2 spiral art. Loading up packages I’m definitely in love with “magick” right now :)
library(tidyverse) ## for pretty much everything...
library(magick) ## I'm now a magick fan!!! 
library(scales) ## Handy when it comes to scaling, but I also love show_col function
library(patchwork) ## put ggplot side by side easily :) 

## Let's just set some of my favourite number.
phi <- (1 + sqrt(5)) / 2 
golden_angle <- pi*(3-sqrt(5))
Function To Draw Artwork Instead of creating data frame, then plot with ...
[Read more...]

Making Original Bingo – Heart Theme

January 5, 2019 | R on Chi's Impe[r]fect Blog

I have learned how to draw a heart with mathmatical equation, in fact there are so many “curves” you can draw with equation. Amazing, right?!? You can find all sorts of different curves on Wolfram Mathworld site. I’m really curious how did people find equation itself for some of ...
[Read more...]

Plotting Traditional Colours of Japan

November 28, 2018 | R on Chi's Impe[r]fect Blog

I was curious to know what colours were Traditional Colours of Japan. One of the site I came across showing 465 palettes of Japanese colour is this one. Japanese Site with 465 palettes of traditional colour. While site displays colour beautifully, to see every colour you need to scroll quite bit, so ...
[Read more...]

Popular Halloween Candy on US State Grid Map

October 24, 2018 | R on Chi's Impe[r]fect Blog

Halloween is coming..! Halloween is just around the corner, I am still trying to decide which candies to purchase this year for trick-or-treaters. Initially I was looking for data sets maybe comparing American chocolate bars vs Canadian chocolate bars possibly with sugar contents or lists of ingredients. I am really ...
[Read more...]

Cannibus Curve with ggplot2

October 16, 2018 | R on Chi's Impe[r]fect Blog

Starting today, recreational weed is legal in Canada. This news has some how lead me to find Cannibus Curve, a mathmatical equation to draw Cannibus….!!! So to celebrate? being 2nd country in the world (1st was Uruguay) to legalize the green stuff for fun, I decided I’ll try drawing ...
[Read more...]

16 Personalities with Circlize

May 19, 2018 | R on Chi's Impe[r]fect Blog

16 Personalities While back, my husband introduced me to this fun online personalities test called 16 personalities. I’ve taken the test, and my personalities type came back as Mediator (Code: INFP - Role: Diplomat) There were difinitely some traits that sounded like me, and a lot of statement I can relate ...
[Read more...]

Testing Entry with R Rmarkdown File

May 18, 2018 | R on Chi's Impe[r]fect Blog

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")
[Read more...]

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)