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)

[log in to unmask]">

[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 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 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.