Print

Print


Rosa, the axis() function requires you to specify the “at” argument. This argument specifies where the tick-marks are to be drawn.

Here is an example that might be useful:

set.seed(1)
v1 <- c("Total energy consumption per SF","Chilled water energy consumption per SF","Steam water energy consumption per SF", "Electricity energy consumption per SF")
tmp=data.frame(y=rnorm(12),x=rep(v1,each=3))
z=boxplot(y~x,data=tmp,xaxt='n')
axis(side=1,labels=v1,at=1:4,las=2)

Best,
Denis

From: UF R Users List [mailto:[log in to unmask]] On Behalf Of Rosa (Haekyung Im)
Sent: Wednesday, October 10, 2018 3:59 AM
To: [log in to unmask]
Subject: Labeling x-axis

Hi,
I have a difficult time of labelling.
My R coding is as follow:
boxplot(total_energyperSF,kbtuCHWC, kbtuSTM, kbtuELC, main="boxplot of energy consumption",
        xlab="Time", ylab="Kbtu", col=terrain.colors(4))
# Define the position of tick marks########################################
v1 <- c("Total energy consumption per SF","Chilled water energy consumption per SF","Steam water energy consumption per SF", "Electricity energy consumption per SF")
# Add an axis to the plot
axis(side = 1,at = v1, labels = v1, tck=-.05)
[cid:[log in to unmask]]
[cid:[log in to unmask]]
How can I label it properly?
I put index instead of labeling, but I would like to know how to label it.

Best,
Rosa
Sent from Mail<https://urldefense.proofpoint.com/v2/url?u=https-3A__go.microsoft.com_fwlink_-3FLinkId-3D550986&d=DwMFaQ&c=pZJPUDQ3SB9JplYbifm4nt2lEVG5pWx2KikqINpWlZM&r=QWxQId63qB2iSP1ggUL7kQsdfEWUTu6qCGEw8Xuo91A&m=n-kfpXUFJTeeLFxViqhNdFsp53EMrSKsJZuRxySRUTA&s=n6Zn9qMmVQ_0qapzvSprRi1HzFqx5gxXS3DgWFvc2HI&e=> for Windows 10

This list strives to be beginner friendly. However, we still ask that you PLEASE do read the posting guide http://www.R-project.org/posting-guide.html<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org_posting-2Dguide.html&d=DwMFaQ&c=pZJPUDQ3SB9JplYbifm4nt2lEVG5pWx2KikqINpWlZM&r=zAVYZd3B5rRMa_OS6MyRQQ&m=7eNpNuUCvVaQcaz0H3juDA0bo2Alcmk0GRQRCQpJEP8&s=tjorEsEHWaVW7j69qw9wG4-MQmINeWve4oiXuZ1aE-0&e=> and provide commented, minimal, self-contained, reproducible code.

This list strives to be beginner friendly.  However, we still ask that you
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.