简体   繁体   中英

Add labels on X-axis

Simple question.

I'd like to add custom characters to label the X-axis in R Histogram.

As can be seen on the image belov, the only labeling for the units is 0,50,100 but I'd like to have 0,5,10,15,etc (or 0:5,5:10,10:15,15:20,etc written perpendicular to the axis)

我是多么喜欢它的插图

Is there a variable I've overlooked in customizing the addition of labels or do i need to use another lib than Hist, perhaps ggplot2?

Replying to someone who might be making a histogram without using ggplot2:

set.seed(0)
hist(runif(250, 0, 100), cex.axis = 0.6, xaxt = "n",
     col = rgb(0,0, 0.8, 0.35), border = FALSE, xlab = "x", main = "")

myseq <- as.character(seq(0,100, by = 5))
axis(1, at = myseq, labels = myseq, cex.axis = 0.6)
title(main = "Using of the graphics package", xlab = "x")

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