Skip to content

Instantly share code, notes, and snippets.

@dsparks
Created March 12, 2014 16:36
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dsparks/9510857 to your computer and use it in GitHub Desktop.
Save dsparks/9510857 to your computer and use it in GitHub Desktop.
An example using manipulate to modify a ggplot object. Requires RStudio.
aPlotFunction <- function(hh, ss, sz){
zp1 <- qplot(data = cars, x = dist, y = speed,
colour = I(hsv(hh/255, 1, 1)),
shape = I(ss),
size = I(sz))
print(zp1 + theme_bw())
}
manipulate(
aPlotFunction(hh, ss, sz),
hh = slider(0, 255, step = 1, initial = 0),
ss = slider(1, 255, step = 1, initial = 1),
sz = slider(1, 20, step = 1, initial = 1))
@ZeccaLehn
Copy link

Excellent!

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