0

I'm having problems changing the y-axis on my Effect plots of soil moisture in relation to berry presence.

Soil moisture graph:

enter image description here

I would like to display the presence on y-axis from 0 to 1, so it would be comparable with other similar graphs, preferably with ticks at every 0.1 points. From the help section of the Effect package, I was able to understand that the package adjusts the axis to make nice graphs. How does one change that? I've found very little information on changing the y-axis, everyone seems to be concerned just with the x-axis.

I'm using a binomial GLM for the modeling of several variables (soil moisture, slope, distance from the edge) in relation to berry presence, then visualizing each one on the effect plot:

m3<-glm(pres_BL ~ soil_moist + Slope + EdgeDist, data=BC, family="binomial")

plot(effect("soil_moist",m3), xlab="soil_moist", ylab="Presence of bilberries")

Thank you for any information,

Med

jazzurro
  • 23,179
  • 35
  • 66
  • 76
Med Ved
  • 21
  • 1
  • 4

2 Answers2

2

After trying many possible solutions, I finally cracked it.

The trick is to use rescale.axis=F and thus not allow the package to label the y-axis on the response scale, as is default. I also used ylim = c(0,1), because I wanted the whole 0-1 probability scale.

I hope this helps someone who is just as lost as I was.

Med Ved
  • 21
  • 1
  • 4
1

Unsure whether there is something special about effect package and the way it plots but this should be able to be done with:

plot(effect("soil_moist",m3), xlab="soil_moist",
 ylab="Presence of bilberries", ylim = c(0,1),  yaxt = "n")

This will set the yaxis to between 0 and 1 and stop it from generating default labels.

You can then set the ticks on the y axis (i.e. axis 2) to 0.1 intervals using:

axis(2, at=seq(0, 1, by = .1), labels=seq(0, 1, by = .1), las = 2)
sinjacks
  • 33
  • 4
  • Yes, it must be something specific to the effect package, because this solution just mangles the axis which now starts at 0.5. The second part with the ticks has no impact whatsoever. Link to the image (https://ibb.co/mm4Z5G) – Med Ved Dec 03 '17 at 09:48