[R] Gap between plots, how to reduce

Rui Barradas ru|pb@rr@d@@ @end|ng |rom @@po@pt
Tue Sep 13 07:25:26 CEST 2022


Hello,

OK, if you force the plot area to be square, it will become smaller.
Below, I do not change boxwex.


old_par <- par(pty = "s")  # plot type = square

colors = rep("green",6)
at.x <- seq(1,by=.4, length.out = 10)
boxplot(RF,Ranger, SVM, KNN, DT,
         range = 0,
         col = colors,
         names = c("RF","Ranger", "SVM", "KNN", "DT"),
         main = "Consistent features with 10-fold vs LOO ")

par(old_par)    # put the default back


Hope this helps,

Rui Barradas

Às 06:15 de 13/09/2022, Neha gupta escreveu:
> Thank you for your reply.
> 
> Actually when I adjust boxwex (up to 0.8), it increases the width of the
> plot. What I want is to reduce the size of the container (where all the
> plots are displayed) so that it takes a small space on the paper.
> 
> Best regards
> 
> On Tue, Sep 13, 2022 at 7:08 AM Rui Barradas <ruipbarradas using sapo.pt> wrote:
> 
>> Hello,
>>
>> I may be wrong but if you do not change boxwex the deafual boxwex=0.8 is
>> used and the white space is reduced.
>> And if you increase the value, for instance to boxwex = 0.9, the white
>> space is even smaller.
>>
>> Is this what you want?
>>
>> Hope this helps,
>>
>> Rui Barradas
>>
>> Às 05:58 de 13/09/2022, Neha gupta escreveu:
>>> Hi
>>>
>>> There is a gap between plots (white spaces) when I draw the boxplot. I
>> want
>>> to reduce the spaces between the plots so that the boxplot takes a small
>>> space. When I just adjust "boxwex" values, the length of individual plots
>>> increases/decreases but the white spaces is still there.
>>>
>>> My code:
>>>
>>> RF= c(100,100,100,33.3,100,100)
>>> Ranger= c(66.6, 100, 100, 33.3, 100, 81.8)
>>> SVM= c(81.8, 100, 100, 66.6, 81.8, 81.8)
>>> KNN= c(33.3, 25, 53.8, 25, 11.1, 5.2)
>>> DT= c(100, 100, 100, 25, 100, 100)
>>>
>>> mean(DT)
>>>
>>> colors = rep("green",6)
>>> at.x <- seq(1,by=.4, length.out = 10)
>>> boxplot(RF,Ranger, SVM, KNN, DT, range = 0, boxwex=0.4,col=colors, names=
>>> c("RF","Ranger", "SVM", "KNN", "DT"),main="Consistent features with
>> 10-fold
>>> vs LOO ")
>>>
>>>        [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>
>



More information about the R-help mailing list