   Example: (extract-series {:x f, :y g, :bubble bubble} coll)
         == {:x (map f coll), :y (map g coll), :bubble (map bubble coll)}"
   [keymap coll]
-  (into {}
-        (for [[k v] keymap]
-          [k (map v coll)])))
+  (map-vals #(% coll) keymap))
+
+(defn- normalize-group
+  [m]
+  (let [sum (reduce + (vals m))]
+    (map-vals #(/ % sum) m)))
+
+(defn normalize-categories
+  [m]
+  (->> (transpose-map m)
+       (map-vals normalize-group)
+       transpose-map))

                        JFrame
                        SwingUtilities)))

(def colors
  "All the default java.awt colors as keywords. You can use this map
  to iterate over the keys, in case you'd like to compare different

  value 0.0 is inserted. If there are other x values not in x-order, they are
  attached at the end in sorted order."
  [series-map x-order]
  (let [series-map (map-vals normalize-category-series series-map)
        x-order (vec x-order)
        extra-xs (sort (set/difference (category-series-xs series-map)
                                       (set x-order)))
        x-order (into x-order extra-xs)]
    (map-vals #(reorder-series % x-order) series-map)))

(defn category-chart
  "Returns a category chart. See the tutorial for more information
