Created
May 15, 2017 00:12
-
-
Save memilanuk/4563592111b2a80d6f452fddc14aba74 to your computer and use it in GitHub Desktop.
Contour Plot / Heat Map for Load Development
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
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)" | |
) |
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
Okay... that was a PITA. Tried downgrading the
![screenshot from 2017-05-14 @@18-56-21](https://cloud.githubusercontent.com/assets/1961428/26040133/58ce715a-38d7-11e7-8739-5d6e3d24a9bb.png)
r-base
package, hoping the others would follow suite... no go. Ended up uninstalling all of R, and re-installing it. Then updating the stuff pulled in as a part ofr-base
, which forced a recompile of the offending packages. Seems to be working now.@damoncali question on the code... any particular reason you took columns from the CSV file i.e.
groups$CTBO
and turned around and created new columns in the data frame i.e.groups$x
instead of justx <- groups$CTBO
?I went thru and changed all the other references to
groups$x
andgroups$y
to justx
andy
, and the script / plot still seems to work just fine, and looks a bit cleaner as well.