Skip to content

Instantly share code, notes, and snippets.

@mattwigway
Created February 1, 2025 20:57
Show Gist options
  • Save mattwigway/a4c285018272d8ff067cba27098198c5 to your computer and use it in GitHub Desktop.
Save mattwigway/a4c285018272d8ff067cba27098198c5 to your computer and use it in GitHub Desktop.
```{julia}
using CSV, DataFrames, Plots, Downloads, ProgressMeter
```
Download data
```{julia}
if !isfile("bay_area_freeways.csv.gz")
progress = nothing
Downloads.download("https://files.indicatrix.org/bay_area_freeways.csv.gz", "bay_area_freeways.csv.gz",
progress=(total, sofar) -> begin
if total > 0 && isnothing(progress)
progress = Progress(total)
elseif total > 0
update!(progress, sofar)
end
end)
finish!(progress)
else
println("Data already downloaded.")
end
```
## Read data
```{julia}
sensors = CSV.read("bay_area_freeways.csv.gz", DataFrame)
```
Make a large plot
```{julia}
# this will cause VSCode to hang
#scatter(sensors.avg_occ, sensors.avg_speed_mph, fmt=:png)
# This is small enough VSCode will not hang, but you can inspect to see that is rendered as SVG
scatter(sensors.avg_occ[1:1000], sensors.avg_speed_mph[1:1000], fmt=:png)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment