Skip to content

Instantly share code, notes, and snippets.

@randyzwitch
Created November 4, 2015 18:12
Show Gist options
  • Save randyzwitch/fc2a24e93d4d4d8620f3 to your computer and use it in GitHub Desktop.
Save randyzwitch/fc2a24e93d4d4d8620f3 to your computer and use it in GitHub Desktop.
Plotting bivariate kde
using RDatasets, KernelDensity
faithful = dataset("datasets", "faithful");
a = kde((faithful[:Eruptions],faithful[:Waiting]));
#How do I get cartesian product of x and y, such that it represents same coordinates as reshaped color?
x = collect(a.x) #256-element Array{Float64,1}
y = collect(a.y) #256-element Array{Float64,1}
color = reshape(a.density, 65536) #65536-element Array{Float64,1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment