Last active
July 9, 2024 12:45
-
-
Save spdegabrielle/fc90626232ef8e088d11ef10eb329704 to your computer and use it in GitHub Desktop.
cities plot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(require plot) | |
(require pict) | |
(define (pick l) | |
(list-ref l (random (length l)))) | |
(define (pick-colour) | |
(pick (list "red" "orange" "yellow" "green" "blue" "indigo" "violet"))) | |
(struct city (name lat long)) | |
(define cities (list | |
(city "Melbourne" -37.814167 144.963056) | |
(city "Darwin" -12.438056 130.841111) | |
(city "London" 51.507222 -0.1275) | |
(city "Berlin" 52.52 13.405) | |
(city "Valetta" 35.898333 14.5125) | |
(city "Honolulu" 21.306944 -157.858333))) | |
(parameterize ([plot-width 720] | |
[plot-height 360] | |
[plot-x-label "#t"] | |
[plot-y-label #f] | |
[plot-x-ticks (linear-ticks) | |
] | |
[plot-y-ticks (linear-ticks) | |
] | |
) | |
(plot (list (map (λ (a-city) | |
(point-label (vector (city-long a-city) (city-lat a-city)) | |
(city-name a-city))) cities) | |
) | |
#:x-min -180 #:x-max 180 | |
#:y-min -90 #:y-max 90)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment