简体   繁体   中英

Boxplot overlaping text and dots

I have this code exported from Rdata

load(...)
ViajesCCAA <- subset(ViajesCCAA, subset=CCAA.DESTINO=="SOMETHING")
library(relimp, pos=4)
showData(ViajesCCAA, placement='-20+200', font=getRcmdr('logFont'), maxwidth=80, maxheight=30)
Boxplot(GASTO.FINAL.DEL.VIAJE~MES, data=ViajesCCAA, id.method="y")

And the output is something like this:

箱形图

I've tried this but couldn't load

par(cex.lab=1.5) # is for y-axis

par(cex.axis=1.5) # is for x-axis

It says :

[13] ERROR: invalid subscript type 'list'

My data :

[1] "7444"  "105"   "1744"  "7159"  "7157"  "6824"  "3858"  "236"   "5927"  "2288"  "9698"  "12708" "10930" "10459" "11050" "12087" "9968"  "9151"  "11950" "9143" 

Since you are using RCommander, I'll try to stick the as simple solutions as possible, although there may be better solutions in R.

The most simple solution is to get rid of labels - in your example they are just case numbers. In RCommander you just need to check "No" in "Outliers identification" in tab "Options" from "Boxplot" command.

If you want to keep labels, you can just make smaller all graphical elements by using (in R console):

par(cex=.5)

This setting gets the work done but it has the secondary effect of reducing all labels, not just ouliers ones. You can work around this by enlarging other elements:

par(cex=.5, cex.lab=2, cex.axis=2)

When setting parameters using the R Console, please keep in mind that R Commander tends to reset graphical parameters when it opens a new graphical window. To prevent my graphical parameters from being reset, I usually do:

  • Make the graphic with default parameters (that is, I draw a boxplot using menus) and then don't close the graphic window.
  • Set the parameters in R console (for example, par(cex=.5)).
  • Make the graphic again (Boxplot menu again). Now it appears with the graphical parameters I just set.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM