Skip to content

Commit

Permalink
Seattle parks - progress with barchart
Browse files Browse the repository at this point in the history
  • Loading branch information
daslu committed Jan 24, 2024
1 parent eb6badb commit 4ff375a
Showing 1 changed file with 30 additions and 15 deletions.
45 changes: 30 additions & 15 deletions projects/geography/seattle-parks/notebooks/index.clj
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,7 @@ For every neighborhood, we will compute the proportion of its area covered by pa
vec)))
(tc/add-column :park-proportion
#(fun// (:intersection-area %)
(:neighborhood-area %)))
(tc/order-by [:park-proportion] :desc)))
(:neighborhood-area %)))))

(delay
(-> neighborhoods-with-park-proportions
Expand All @@ -386,27 +385,43 @@ For every neighborhood, we will compute the proportion of its area covered by pa
:park-names
:neighborhood-area
:intersection-area
:park-proportion])))
:park-proportion])
(tc/order-by [:park-proportion] :desc)))


(defn plot-neighborhoods-with-park-proportions [data]
(kind/echarts
{:title {:text "Neighborhoods by park proportion"}
:tooltip {}
:xAxis {:data (:S_HOOD data)
:axisLabel {:rotate 90}}
:yAxis {}
:series [{:type "bar"
:data (:park-proportion data)}]
:grid {:containLabel true}}))

(delay
(-> neighborhoods-with-park-proportions
(tc/order-by [:park-proportion] :desc)
plot-neighborhoods-with-park-proportions))

(delay
(-> neighborhoods-with-park-proportions
(tc/order-by [:park-proportion] :desc)
(tc/head 10)
plot-neighborhoods-with-park-proportions))

;; # A choroplety colored by park proportions




(kind/echarts
{:title {:text "Neighborhoods by park proportion"}
:tooltip {;; :data (:S_HOOD
;; neighborhoods-with-park-proportions)
}
:xAxis {:data (:S_HOOD
neighborhoods-with-park-proportions)}
:yAxis {}
:series [{:type "bar"
:data (:park-proportion
neighborhoods-with-park-proportions)}]})






;;



Expand Down

0 comments on commit 4ff375a

Please sign in to comment.