Skip to content

Instantly share code, notes, and snippets.

@alanorth
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alanorth/31b2cd680593a756c93a to your computer and use it in GitHub Desktop.
Save alanorth/31b2cd680593a756c93a to your computer and use it in GitHub Desktop.
Tag cloud for ILRI jobs using Processing and Wordcram
import wordcram.*;
void setup() {
// Set up the Processing sketch
size(600, 400);
// RGB color mode is easier for humans
colorMode(RGB);
background(255,255,255);
// not sure if this does anything
smooth();
try {
new WordCram(this)
// text file with words
.fromTextFile("/home/aorth/Downloads/job_names.txt")
// ILRI red, gray, and darker gray
.withColors(color(104,38,34), color(34,34,33), color(134,134,134))
.sizedByWeight(10, 90)
.withWordPadding(2)
.withAngler(Anglers.heaped())
//.angledAt(radians(30), radians(30), radians(-60))
.withFont("Open Sans")
// filter these generic job types out
.withStopWords("interactive sbatch")
.toSvg("research-computing-jobs.svg", width, height)
.drawAll();
}
catch (java.io.FileNotFoundException x) {
println(x.getMessage());
}
println("done rendering the SVG");
println("loading the svg...");
PShape sh = loadShape("research-computing-jobs.svg");
background(255);
shape(sh, 0, 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment