
# rockchalk

### [Rmd](rockchalk.Rmd)


With `library(rockchalk)`, graphs are not interactive but knittable.

[doc](https://www.rdocumentation.org/packages/rockchalk)


```{r}
df <- read.delim("http://md.psych.bio.uni-goettingen.de/data/div/sat.txt")
m.i <- lm(univ_GPA ~ math_SAT * verb_SAT, data=df)

require(rockchalk)
plotPlane(model = m.i, plotx1 = "math_SAT", plotx2 = "verb_SAT")

# or to emphasize the view of the interaction
plotPlane(model = m.i, plotx1 = "math_SAT", plotx2 = "verb_SAT", theta = 0, phi = 10)
plotPlane(model = m.i, plotx1 = "math_SAT", plotx2 = "verb_SAT", drawArrows = T)

```



## Example Fishes

[source](https://stackoverflow.com/questions/40748949/match-gridlines-to-axis-ticks-in-3d-regression-plot-persp-and-rockchalk)

```{r}
# create data frame df
df <- structure(list(Sample = structure(1:12, .Label = c("r.2002.c.1", 
  "r.2002.c.2", "r.2002.c.3", "r.2002.c.4", "r.2002.c.5", "r.2002.c.6", 
  "r.2002.s.1", "r.2002.s.2", "r.2002.s.3", "r.2002.s.4", "r.2002.s.5", 
  "r.2002.s.6"), class = "factor"), Coral.cover = c(59L, 71L, 55L, 
  58L, 62L, 65L, 86L, 71L, 91L, 63L, 75L, 63L), Coral.richness = c(5L, 
  9L, 10L, 10L, 8L, 10L, 10L, 10L, 6L, 0L, 2L, 2L), Water.Temp = c(23.9, 
  33.43, 23.33, 22.14, 26.82, 29.07, 38.76, 30.28, 27.85, 28.03, 
  31.67, 29.43), fish.rich = c(57L, 70L, 55L, 56L, 61L, 64L, 84L, 
  68L, 89L, 62L, 75L, 63L)), .Names = c("Sample", "Coral.cover", 
  "Coral.richness", "Water.Temp", "fish.rich"), class = "data.frame", row.names = c(NA, 
  -12L))

Coral.cover <- df[,2]
Coral.richness <- df[,3]
fish.rich <- df[,5]

# libraries
#require(Hmisc)
require(car)
# require(vegan)
require(rockchalk)
#require(reshape)
require(persp)

mod3 <- mcGraph3(Coral.cover, Coral.richness, fish.rich, 
             interaction = F,
             theta = -40 ,
             phi =20,
             x1lab = "",
             x2lab = "",
             ylab = "",
             x1lim = c(46,100),
             ylim = c(-2.5, 12.5),
             zlim =c(40, 100),
             r=10,
             col = 'white',
             border = 'black',
             box = T,
             axes = T,
             ticktype = "detailed",
             ntick = 4)

```


Version: `r format(Sys.time(), '%d %B, %Y %H:%M')`