-
-
Save mdfarragher/d0851dfe795145f8a2736a3cfa25a533 to your computer and use it in GitHub Desktop.
This file contains 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
// a helper class to access the new binned columns | |
public class BinnedHouseBlockData | |
{ | |
public float BinnedLongitude { get; set; } | |
public float BinnedLatitude { get; set; } | |
public float MedianHouseValue { get; set; } | |
} | |
// get an array of binned housing data | |
var binnedHhouses = context.Data.CreateEnumerable<BinnedHouseBlockData>(transformedData, reuseRowObject: false).ToArray(); | |
// plot median house value by binned latitude and longitude | |
var chart = Chart.Plot( | |
new Graph.Scattergl() | |
{ | |
x = binnedHhouses.Select(v => v.BinnedLongitude), | |
y = binnedHhouses.Select(v => v.BinnedLatitude), | |
mode = "markers", | |
marker = new Graph.Marker() | |
{ | |
symbol = "square", | |
size = 32, | |
color = binnedHhouses.Select(v => v.MedianHouseValue), | |
colorscale = "Jet" | |
} | |
} | |
); | |
chart.WithXTitle("Binned Longitude"); | |
chart.WithYTitle("Binned Latitude"); | |
chart.WithTitle("Median house value by binned location"); | |
chart.Width = 600; | |
chart.Height = 600; | |
display(chart); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment