Hi Stefano,
The bar x centers are returned by the barplot function. You can also
use the barp function (plotrix package) that places the bars at unit
intervals by default.

Jim

On Thu, Sep 15, 2022 at 3:47 PM Stefano Sofia
<stefano.so...@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.so...@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@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://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 http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to