Skip to content

Instantly share code, notes, and snippets.

@memilanuk
Created May 15, 2017 00:12
Show Gist options
  • Save memilanuk/4563592111b2a80d6f452fddc14aba74 to your computer and use it in GitHub Desktop.
Save memilanuk/4563592111b2a80d6f452fddc14aba74 to your computer and use it in GitHub Desktop.
Contour Plot / Heat Map for Load Development
require(lattice)
require(spatial)
groups <- read.csv(file="Desktop/damoncali.csv",head=TRUE,sep=",")
groups$x <- groups$CBTO
groups$y <- groups$Charge
groups$z <- groups$ES.MOA
x.Margin <- 0.00
y.Margin <- 0.0
groups.ls <- surf.ls(3, groups$x, groups$y, groups$z)
groups.surface <- trmat(groups.ls, min(groups$x) - x.Margin, max(groups$x) + x.Margin, min(groups$y) - y.Margin, max(groups$y) + y.Margin, 500)
str(groups.surface)
colfunc <- colorRampPalette(c("green", "yellow", "orange", "red"))
image(groups.surface, col = colfunc(12)) #heat.colors(20))
contour(groups.surface, labcex = .75, add=T, nlevels = 20)
points(groups$x, groups$y)
title(
xlab="CBTO (in)",
ylab="Varget (gr)"
)
@damoncali
Copy link

damoncali commented May 15, 2017

The code is a little sloppy. I wasn't sure what I was going to do with it and never really thought anyone else would ever see it, honestly. So yeah, there are some weird spots. I basically stoped working on it the second it worked. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment