Skip to content

Instantly share code, notes, and snippets.

@baptiste
Last active August 16, 2019 06:39
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save baptiste/d4abfa8a6c095d659f8879af5ad9531b to your computer and use it in GitHub Desktop.
Save baptiste/d4abfa8a6c095d659f8879af5ad9531b to your computer and use it in GitHub Desktop.
library(jsonlite)
library(ggplot2)
library(ggChernoff)
# https://github.com/Bowserinator/Periodic-Table-JSON
d <- jsonlite::fromJSON('PeriodicTableJSON.json')[["elements"]]
ggplot(d, aes(xpos,10-ypos)) +
geom_chernoff(aes(fill=category, size = phase, smile = density, brow = molar_heat)) +
geom_text(aes(label=symbol), vjust=2.5) +
guides(fill=guide_legend(ncol=2)) +
theme_void() +
scale_brow_continuous(breaks = c(10, 25, 50))+
theme(legend.position = 'right', panel.background = element_rect(colour="black"))
@baptiste
Copy link
Author

screen shot 2017-12-29 at 7 18 32 pm

@markhogue
Copy link

This is really cool, but when I try to run the script, I get:

d <- jsonlite::fromJSON('PeriodicTableJSON.json')[["elements"]]
Error: lexical error: invalid char in json text.
PeriodicTableJSON.json
(right here) ------^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment