Oh, and for your last example, what you actually do is plot 25 separate axes with one label each, one on top of the other. Again, correction requested if this is wrong.
-- Bert "An educated person is one who can entertain new ideas, entertain others, and entertain herself." On Wed, May 28, 2025 at 2:28 PM Marc Girondot via R-help <r-help@r-project.org> wrote: > > Can someone explain me why in the second example, only one label is shown ? > > Thanks a lot > > Marc > > atT <- structure(c(1672520400, 1675198800, 1677618000, 1680296400, > 1682888400, > 1685566800, 1688158800, 1690837200, 1693515600, 1696107600, > 1698786000, > 1701378000, 1704056400, 1706734800, 1709240400, 1711918800, > 1714510800, > 1717189200, 1719781200, 1722459600, 1725138000, 1727730000, > 1730408400, > 1733000400, 1735678800), class = c("POSIXct", "POSIXt"), > tzone = "Asia/Riyadh") > > # Work as expected > plot(x = atT, y=rep(1, length(atT)), xaxt="n") > axis(side = 1, at=atT, labels = as.character(seq_along(atT))) > > # Only first label is shown > plot(x = atT, y=rep(1, length(atT)), xaxt="n") > axis(1, at=atT, label=c("Jan-2023", "", "", "", "", "", "Jul-2023", "", > "", "", "", "", > "Jan-2024", "", "", "", "", "", > "Jul-2024", "", "", "", "", "", > "Jan-2025"), cex.axis=0.8) > > # All labels are shown... but not elegant ! > plot(x = atT, y=rep(1, length(atT)), xaxt="n") > for (i in seq_along(atT)) { > axis(1, at=atT[i], label=c("Jan-2023", "", "", "", "", "", > "Jul-2023", "", "", "", "", "", > "Jan-2024", "", "", "", "", "", "Jul-2024", > "", "", "", "", "", > "Jan-2025")[i], cex.axis=0.8) > > } > > > R.version > _ > platform aarch64-apple-darwin20 > arch aarch64 > os darwin20 > system aarch64, darwin20 > status Patched > major 4 > minor 5.0 > year 2025 > month 05 > day 16 > svn rev 88216 > language R > version.string R version 4.5.0 Patched (2025-05-16 r88216) > nickname How About a Twenty-Six > > ------------------------------------------------------------------------ > *Marc Girondot, Pr* > > Laboratoire Ecologie, Société, Evolution > Equipe de Processus Ecologiques et Pressions Anthropiques > CNRS, AgroParisTech et Université Paris-Saclay, UMR 8079 > 91190 Gif-sur-Yvette, France > > Tel: +33 (0)1.69.15.72.30 Mobile: +33 (0)6.20.18.22.16 > e-mail: marc.giron...@universite-paris-saclay.fr > marc.giron...@gmail.com > > Web: http://hebergement.universite-paris-saclay.fr/marcgirondot/ > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide https://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.