lrberge / fixest

Fixed-effects estimations
https://lrberge.github.io/fixest/
379 stars 61 forks source link

Period markers in iplot #516

Open brianfeld-esd opened 3 months ago

brianfeld-esd commented 3 months ago

Not sure if this is a bug (probably not), but when I call iplot to plot the estimates of an event study model, only the even periods are marked in the x-axis. Is there a straightforward way of including all period markers?

grantmcdermott commented 2 months ago

Behind the scenes, iplot is simply calling R's base plotting logic. The automatic selection of axes ticks is governed by par("lab"). Per the docs:

lab: A numerical vector of the form c(x, y, len) which modifies the default way that axes are annotated. The values of x and y give the (approximate) number of tickmarks on the x and y axes and len specifies the label length. The default is c(5, 5, 7). len is unimplemented in R.

So one option would be to increase the x default, e.g.

op = par(lab = c(10,5,7))
iplot(...)
par(op) # reset the original params

If you would prefer a more controlled approach, then you could manually configure /override the x axis. See here for example.

Finally, you could look at at ggfixest if you'd be more comfortable configuring a ggplot2 implementation rather than base plots.