Just curious which one others think looks better. I really like the colors on the one on the right, but the one on the left is also interesting. The right plot seems to have some blurriness to it that goes along with the color palette, while the other one is less so. My opinion is that the colors don't blend as well in the plot on the left. Part of the fun with this is finding the right balance of colors.

library(graphics)
par(mfrow=c(1,2))
smoothScatter(data$pz~data$px, nbin=1000, colramp = colorRampPalette(c("darkblue", "blue", "lightblue", "green", "yellow", "orange", "darkorange", "red", "pink")), nrpoints=Inf, pch=19, cex=.7, transformation = function(x) x^.75, col="black", main="Johnny Cueto Location (May 11, 2010)", xlab="Horizontal Location", ylab="Vertical Location")
lines(c(0.708335, 0.708335), c(mean(data$sz_bot), mean(data$sz_top)), col="white", lty="dashed", lwd=2)
lines(c(-0.708335, -0.708335), c(mean(data$sz_bot), mean(data$sz_top)), col="white", lty="dashed", lwd=2)
lines(c(-0.708335, 0.708335), c(mean(data$sz_bot), mean(data$sz_bot)), col="white", lty="dashed", lwd=2)
lines(c(-0.708335, 0.708335), c(mean(data$sz_top), mean(data$sz_top)), col="white", lty="dashed", lwd=2)
library(RColorBrewer)
buylrd <- c("#313695", "#4575B4", "#74ADD1", "#ABD9E9", "#E0F3F8", "#FFFFBF", "#FEE090", "#FDAE61", "#F46D43", "#D73027", "#A50026") smoothScatter(data$pz~data$px, nbin=1000, colramp = colorRampPalette(c(buylrd)), nrpoints=Inf, pch="", cex=.7, transformation = function(x) x^.6, col="black", main="Johnny Cueto Location (May 11, 2010)", xlab="Horizontal Location", ylab="Vertical Location") lines(c(0.708335, 0.708335), c(mean(data$sz_bot), mean(data$sz_top)), col="white", lty="dashed", lwd=2) lines(c(-0.708335, -0.708335), c(mean(data$sz_bot), mean(data$sz_top)), col="white", lty="dashed", lwd=2) lines(c(-0.708335, 0.708335), c(mean(data$sz_bot), mean(data$sz_bot)), col="white", lty="dashed", lwd=2) lines(c(-0.708335, 0.708335), c(mean(data$sz_top), mean(data$sz_top)), col="white", lty="dashed", lwd=2) And, for good measure, the same plots using a single color shaded differently based on density (the default for the smoothScatter function). Just for fun. I don't like these as much, and they look more like blurry scatter plots than anything else.
These are great. How can I get these done for some of the pitchers I am following?
ReplyDeleteplease email me when you can