Adjust distance between x-axis and text in R plot -


in plot below, find distance between x-aixs , date (jan-01-60 mar-31-16) large.

plot of time series data

is there anyway make distance smaller?

here example code:

plot(dates, data, type = "l", lwd = 3, ylab = " ",       xlab = " ", col = "gray35", xaxt='n', ann = false) axis(side=1, at=dates_ten, labels=format(dates_ten, "%b-%d-%y"), las =           1, cex.axis=0.5, las = 1, font = 2, tcl = -0.2) 

many thanks.

you can use padj argument axis

# make reproducible example  dates <- seq(as.date("2016/1/1"), as.date("2016/4/1"), "days") dates_ten <- seq(as.date("2016/1/1"), as.date("2016/4/1"), "10 days") set.seed(42) data <- rnorm(seq_along(dates)) 

vary padj needed:

plot(dates, data, type = "l", lwd = 3, ylab = " ",       xlab = " ", col = "gray35", xaxt='n', ann = false) axis(side=1, at=dates_ten, labels=format(dates_ten, "%b-%d-%y"), las = 1,      cex.axis=0.5, las = 1, font = 2, tcl = -0.2, padj = -2) 

enter image description here


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -