Skip to content

Instantly share code, notes, and snippets.

@aperiodic
Created December 3, 2012 00:48
Show Gist options
  • Save aperiodic/4191900 to your computer and use it in GitHub Desktop.
Save aperiodic/4191900 to your computer and use it in GitHub Desktop.
C2P0 Problem
(ns examples.mountains
(:require [c2po.core :refer [c2po]]
[c2po.geom :as geom]
[c2po.scale :as scale]
[c2po.livereload-server :refer [render!]]))
(def animals
;; episode 2: mountains
{:gelada-baboon {:pop 200000, :child-rate 0.5, :unit 15}
:walia-ibex {:pop 500, :child-rate 1, :unit 10}
:ethiopian-wolf {:pop 550, :child-rate 4, :unit 4}
:guanaco {:pop 500000, :child-rate 1, :unit 35}
:puma {:pop 60000, :child-rate 1, :unit 1}
:grizzly-bear {:pop 200000, :child-rate 0.4, :unit 1}
:marhkor {:pop 25000, :child-rate 1.5, :unit 10}
:snow-leopard {:pop 3500, :child-rate 1, :unit 1}
:golden-eagle {:pop 170000, :child-rate 2, :unit 2}
:wolf {:pop 125000, :child-rate 6, :unit 13}
:giant-panda {:pop 2250, :child-rate 0.5, :unit 1}
;{:golden-snub-nosed-monkey {:pop 11500, :child-rate 1.25, :unit }}
;; not mountains ;:krill {:pop 1e13, :child-rate 7000, :unit 1e6}
})
(def scatterplot {:data (vals animals)
:mapping {:x :child-rate :y :pop}
:scales {:x (scale/log), :y (scale/log)}
:geom (geom/point :opacity 0.33)})
(render! scatterplot)
(spit "broken_scatterplot.svg" (c2po scatterplot))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment