[R] [sm.density.compare] scale up y-axis and additional line type
jim at bitwrit.com.au
Wed Oct 2 03:24:19 CEST 2013
On 10/02/2013 04:43 AM, Xianwen Chen wrote:
> Thanks Jim,
> The picture width is adjusted. That was great help! I really appreciate it.
> Does lwd mean 'line width'? I'm not exactly sure how that will help. Can
> you please explain the intuition behind it?
Yes, "lwd" refers to line width. The combination lty=3,lwd=3 should give
you a thick dotted line.
> Can I also ask another question? My graph is made from 7 plots from
> sm.density.compare(). These 7 plots are put together by:
> To make all 7 plots comparable, I specify y- and x-axis ranges. Here is
> the sample code for one of the plots:
> c(sample_1, sample_2), # sample_1 and sample_2 are two vectors, each
> corresponding to a sample
> rep(1:2, rep(140, 2)),
> lty = c(1, 3),
> lwd = c(1, 3), # This change was made by taking your suggestion.
> col = c("black", "black"),
> xlim=c(-40, 60),
> ylim=c(0, 0.15)
> legend("topright", c("MMNL", "GMNL"), lty = c(1, 3), cex = 1)
> Somehow, xlim and ylim do not have an effect. I did not have this
> problem when I was running R in Arch Linux; but now I'm using Debian Linux.
xlim and ylim seem to work correctly when I tried this:
rep(1:2, rep(140, 2)),
lty = c(1, 3),
lwd = c(1, 3),
col = c("black", "black"),
However, while the lty=3 worked correctly, the lwd=3 didn't. I think
that this function does not pass all of the graphics parameters to the
plot function - see the help page on sm.options.
More information about the R-help