0

I'd like to suppress the x-axis ticks in plotLMER.fnc() (from the languageR package) so that I can define my own values using axis() - I'm using numerical values for analysis, but in the plot I want to display what these values actually mean.

This is easy in plot(), using xaxt="n". For instance:

plot(persexort~speaksexort, data=sexort, xaxt="n")
axis(1, at=1:2, labels=c("Gay","Straight"))

Interestingly, the y-axis ticks equivalent in plot(), yaxt="n", does work in plotLMER.fnc(). Any ideas how to get it to work for the x-axis?

The plotLMER.fnc() code I'm trying to adapt:

plotLMER.fnc(H6sexort, pred="speaksexort", xlabel="Actual sexual orientation", ylabel="Perceived sexual orientation", ylim=c(1,7), cex=0.8, withList=T)

The data:

sexortenv1_2 <- structure(list(persexort = c(5L, 4L, 3L, 3L, 4L, 4L, 5L, 7L,2L, 7L), speaksexort = structure(c(2L, 2L, 1L, 1L, 1L, 1L, 2L,2L, 1L, 2L), .Label = c("2", "4"), class = "factor"), listener = structure(c(1L,1L, 1L, 1L, 1L, 1L, 1L, 45L, 45L, 45L), .Label = c("1", "2","3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14","15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25","26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36","37", "38", "39", "40", "41", "42", "43", "44", "45"), class = "factor")), .Names = c("persexort","speaksexort", "listener"), class = "data.frame", row.names = c(9L,10L, 11L, 12L, 13L, 14L, 15L, 1078L, 1079L, 1080L))

The lmer model (using the lme4 package):

H6sexort <- lmer(persexort ~ speaksexort + (1|listener), data=sexortenv1_2)
yndajas
  • 69
  • 6
  • It's always nice to provide a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example), along with the name of whatever package I need to find the `plotLMER.fnc` function. – mathematical.coffee Aug 21 '15 at 01:57
  • Think I've done that; thanks! – yndajas Aug 21 '15 at 03:01
  • It's not reproducible - can't run the `H6sexort <-` line because you have no `speaksexort` column in your data - do you mean to replace `speaksexort` with `speaker` everywhere? Or is `speaksexort` equal to `fitted(H6sexort)`? – mathematical.coffee Aug 21 '15 at 03:25
  • And why can't you use the `plot()` solution, which produces the same graph as `plotLMER.fnc` and does what you want? – mathematical.coffee Aug 21 '15 at 03:32
  • Whoops - I extracted `speaker` instead of `speaksexort` by mistake. I've corrected this now, I think. – yndajas Aug 22 '15 at 11:26
  • I'm not sure plot works with an `lmer` model - if it does, I don't know the arguments. For instance, I could run the following to produce a boxplot of `persexort` by `speaksexort`, but that isn't the same as the model from `lmer`: [newline] `par(mar=c(5,9,2,2) + 0.1)` [newline] `plot(persexort ~ speaksexort, data=sexortenv1_2, xaxt="n", yaxt="n", xlab="Actual sexual orientation", ylab="Perceived sexual orientation")` [newline] `axis(1, at=1:2, labels=c("Gay","Straight"))` [newline] `axis(2, at=1:7, labels=c("1: definitely gay","2","3","4","5","6","7: definitely not gay"), las=1)` – yndajas Aug 22 '15 at 11:27

0 Answers0