leeper / margins

An R Port of Stata's 'margins' Command
https://cloud.r-project.org/package=margins
Other
263 stars 40 forks source link

How to change y-axis limits of plot.margins? #187

Open mpohlig opened 1 year ago

mpohlig commented 1 year ago

Please specify whether your issue is about:

I am trying to change the limits of the y-axis of plot.margins but I cannot find out how. For cplot(), on can simply use the option ylim but that results in an error for plot.margins. How can I change the axis limits of plot.margins, e.g. in order to include zeros for making the graph more intuitively readable?

## load package
library("margins")

## Load data
data(mtacars)

## Run logistic regression
logodd <- glm(vs ~ disp, family = binomial, data = mtcars)

## Plot AME
plot(margins(logodd)) # Works as expected, but y-Axis does not include Zero
plot(margins(logodd), ylim = c(0, -.006)) # Gives error: formal argument "ylim" matched by multiple actual arguments