[R] Overlapping barplots and lines

Stefano Sofia @te|@no@@o||@ @end|ng |rom reg|one@m@rche@|t
Thu Sep 15 15:49:38 CEST 2022


Thanks to Jian and all who replied.

Your suggestions have been perfect.


Stefano


         (oo)
--oOO--( )--OOo--------------------------------------
Stefano Sofia PhD
Civil Protection - Marche Region - Italy
Meteo Section
Snow Section
Via del Colle Ameno 5
60126 Torrette di Ancona, Ancona (AN)
Uff: +39 071 806 7743
E-mail: stefano.sofia using regione.marche.it
---Oo---------oO----------------------------------------


________________________________
Da: Jian MA <majian03 using gmail.com>
Inviato: gioved� 15 settembre 2022 08:39
A: Stefano Sofia
Oggetto: Re: [R] Overlapping barplots and lines

Dear Sofia,

try the following codes:

b1 = barplot(c(55, 80, 120, 90, 105), lwd=1, lend=1, main="", ylab="cm", width=1, ylim=c(0, 120), axes=F)
lines(x = b1, c(70, 50, 100, 60, 70), type="p", pch=21, bg="red")
axis(1, at=b1, labels=c("Dec", "Jan", "Feb", "Mar", "Apr"), pos=-1, cex.axis=0.8)
axis(2, at=seq(0, 120, 10), pos=0)

Best Wishes,
Jian Ma, PhD

On Thu, Sep 15, 2022 at 1:47 PM Stefano Sofia <stefano.sofia using regione.marche.it<mailto:stefano.sofia using regione.marche.it>> wrote:
Dear R-list users,

I have a silly problem with plot that I am not able to solve. I tried to find a solution through the web, with no success.


I need to overlap a barplot with points:


barplot(c(55, 80, 120, 90, 105), lwd=1, lend=1, main="", ylab="cm", width=1, ylim=c(0, 120), axes=F)

lines(c(70, 50, 100, 60, 70), type="p", pch=21, bg="red")

axis(1, at=c(1, 2, 3, 4, 5), labels=c("Dec", "Jan", "Feb", "Mar", "Apr"), pos=-1, cex.axis=0.8)
axis(2, at=seq(0, 120, 10), pos=0)


Points and x-axis are not centered with barplots. How can I fix it?


Thank you for your help

Stefano


         (oo)
--oOO--( )--OOo--------------------------------------
Stefano Sofia PhD
Civil Protection - Marche Region - Italy
Meteo Section
Snow Section
Via del Colle Ameno 5
60126 Torrette di Ancona, Ancona (AN)
Uff: +39 071 806 7743
E-mail: stefano.sofia using regione.marche.it<mailto:stefano.sofia using regione.marche.it>
---Oo---------oO----------------------------------------

________________________________

AVVISO IMPORTANTE: Questo messaggio di posta elettronica pu� contenere informazioni confidenziali, pertanto � destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si � il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si � ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dell'art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessit� ed urgenza, la risposta al presente messaggio di posta elettronica pu� essere visionata da persone estranee al destinatario.
IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system.

--
Questo messaggio  stato analizzato da Libraesva ESG ed  risultato non infetto.
This message was scanned by Libraesva ESG and is believed to be clean.


        [[alternative HTML version deleted]]

______________________________________________
R-help using r-project.org<mailto:R-help using r-project.org> mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help<https://urlsand.esvalabs.com/?u=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-help&e=5a635173&h=06ff70f3&f=y&p=y>
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html<https://urlsand.esvalabs.com/?u=http%3A%2F%2Fwww.R-project.org%2Fposting-guide.html&e=5a635173&h=e12f63e8&f=y&p=y>
and provide commented, minimal, self-contained, reproducible code.

--
Questo messaggio � stato analizzato con Libraesva ESG ed � risultato non infetto

________________________________

AVVISO IMPORTANTE: Questo messaggio di posta elettronica pu� contenere informazioni confidenziali, pertanto � destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si � il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si � ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dell'art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessit� ed urgenza, la risposta al presente messaggio di posta elettronica pu� essere visionata da persone estranee al destinatario.
IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system.

--
Questo messaggio  stato analizzato da Libraesva ESG ed  risultato non infetto.
This message was scanned by Libraesva ESG and is believed to be clean.


	[[alternative HTML version deleted]]



More information about the R-help mailing list