0
$\begingroup$

First off I've been using the truehist() function in R instead of hist() mainly because it looks better (but I'm pretty sure this mainly just because it has a better bin allocation).

Currently, I have a stock returns histogram with a kernel density estimate overlay and a normal density line overlay. I would like to zoom one of the tails of this plot. Is there way of doing this in R?

$\endgroup$
1
  • $\begingroup$ This is about programing in R, not statistics. I suggest you edit your question to include a minimal workable example, then flag it for moderator attention and request migration to StackOverflow. $\endgroup$ May 27, 2015 at 6:24

1 Answer 1

1
$\begingroup$

Simply adjust the $x$ limits:

x <- rnorm( 100 )
truehist( x )
truehist( x, xlim = c( 2, 3 ) )

Nevertheless, it'll keep the maximum of the $y$ axis unchanged, so if you want to ''zoom'' in that way, you might also adjust the scaling of the $y$ axis (i.e. truehist( x, xlim = c( 2, 3 ), ymax = 0.3 )).

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.