[R] [sm.density.compare] scale up y-axis and additional line type
Xianwen Chen
xchen at dr.com
Fri Oct 4 00:43:18 CEST 2013
Hi Jim,
Thanks a lot for your help!
Kind regards,
Xianwen
On 10/02/2013 03:24 AM, Jim Lemon wrote:
> 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:
>>
>> par(mfrow=c(4,2))
>>
>> To make all 7 plots comparable, I specify y- and x-axis ranges. Here is
>> the sample code for one of the plots:
>>
>> sm.density.compare(
>> 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"),
>> xlab="Sample",
>> 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:
>
> sample_1<-runif(280,-20,40)
> sample_2<-runif(280,0,0.1)
>
> sm.density.compare(c(sample_1, sample_2),
> rep(1:2, rep(140, 2)),
> lty = c(1, 3),
> lwd = c(1, 3),
> col = c("black", "black"),
> xlab="Sample",
> xlim=c(-40, 60),
> ylim=c(0, 0.15)
> )
>
> 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.
>
> Jim
More information about the R-help
mailing list