Paulo,
Try the following:
x - rnorm(100)
par(xaxs = i)
par(yaxs = i)
hist(x, breaks = seq(-4, 4, 0.5), ylim = c(0, 40),
xlim = c(-4, 4))
box()
The problem is that graphics:::plot.histogram() is coded in such a way
that the use of 'xaxs' and 'yaxs' are ineffectual, as they are not
Mr. Schwartz,
Thank you very much for the proper solution.
Regards,
Paulo Barata
(Rio de Janeiro, Brasil)
Marc Schwartz (via MN) wrote:
Paulo,
Try the following:
x - rnorm(100)
par(xaxs = i)
par(yaxs = i)
hist(x,
Dear Paulo,
Thank you for your reply. But I doubt yours is a proper
solution to my request, for some reasons:
1. The position of the axis graphed with the command axis(1, line=-1)
depends on the size of the graphics window.
2. After your graph is on the screen, in case one may want a boxed
Dear R users,
The parameters xaxs and yaxs (function par, package graphics)
seem not to work with the function hist (package graphics),
even when the parameters xlim and ylim are defined.
Is there any way to make yaxs=i and xaxs=i work properly
with the function hist, mainly to produce
Paulo
One possibility is to draw the histogram without axes and then add them
wherever you want.
For instance with something along the lines:
x - rnorm(500)
hist(x, axes=F)
axis(1, line=-1)
For more details: ?axis
best
P.J.
Paulo Justiniano Ribeiro Jr
LEG (Laboratório de EstatÃstica e