[R-sig-Geo] How do i plot a graph with x axis vertically labelled?

Sarah Goslee @@r@h@go@lee @ending from gm@il@com
Mon Aug 13 16:32:52 CEST 2018


The graphics parameters are all in the help file for par
?par

The one you need is las.

Without trying to wade thru your mangled HTML data (dput() is the best
way to provide reproducible data), check this out:

barplot(runif(5), names.arg = c("25/08/2004", "26/09/2004",
"02/11/2004", "11/11/2004", "22/11/2004"), main = 'Females 2005', ylab
= ' Age/Days', xlab = 'Birth/Hatch date', las=2)

You'll need to mess with label positioning, and with margin size, to
get everything looking as you wish.

But I'm not sure this is the most effective way to show
irregularly-spaced dates. Why not convert your dates to Date or other
time series, and plot them to scale as points?

Sarah
On Mon, Aug 13, 2018 at 6:25 AM Vasana Tutjavi via R-sig-Geo
<r-sig-geo using r-project.org> wrote:
>
> Dear R-sig-geo experts,
>
> I want to plot a bar graph with the labels on the x axis in a vertical format. The data is the Ages of Squid (on the Y axis) and the date of Birth on the X axis, I am struggling to change the labels on the x axis to a vertical format and I want all the dates to show at all the bars. My data is as follows:
> Birth
> Sex
> Age
> 25/08/2004
> F
> 2
> 26/09/2004
> F
> 3
> 02/11/2004
> F
> 3
> 11/11/2004
> F
> 1
> 22/11/2004
> F
> 3
> 04/12/2004
> F
> 1
> 08/12/2004
> F
> 4
> 15/12/2004
> F
> 4
> 21/12/2004
> F
> 5
> 24/12/2004
> F
> 1
> 04/01/2005
> F
> 1
> 06/01/2005
> F
> 3
> 13/01/2005
> F
> 2
> 18/01/2005
> F
> 1
> 19/01/2005
> F
> 3
> 09/02/2005
> F
> 2
> 11/02/2005
> F
> 1
> 13/02/2005
> F
> 1
> 17/02/2005
> F
> 1
> 18/02/2005
> F
> 8
> 19/02/2005
> F
> 5
> 24/02/2005
> F
> 1
> 28/02/2005
> F
> 42
> 01/03/2005
> F
> 1
> 07/03/2005
> F
> 1
> 08/03/2005
> F
> 2
> 09/03/2005
> F
> 1
> 14/03/2005
> F
> 7
> 16/03/2005
> F
> 1
> 25/03/2005
> F
> 3
> 01/04/2005
> F
> 1
> 06/04/2005
> F
> 5
> 07/04/2005
> F
> 1
> 08/04/2005
> F
> 1
> 13/04/2005
> F
> 1
> 14/04/2005
> F
> 1
> 27/04/2005
> F
> 1
> 01/05/2005
> F
> 2
> 07/05/2005
> F
> 1
> 08/05/2005
> F
> 2
> 16/05/2005
> F
> 1
> 30/05/2005
> F
> 8
> 06/06/2005
> F
> 1
> Here is the script I tried:
>
> barplot(Females2005$Age,  names.arg = c("25/08/2004", "26/09/2004", "02/11/2004", "11/11/2004", "22/11/2004", "04/12/2004", "08/12/2004",
>                                        "15/12/2004", "21/12/2004", "24/12/2004", "04/01/2005", "06/01/2005", "13/01/2005", "18/01/2005",
>                                        "19/01/2005", "09/02/2005", "11/02/2005", "13/02/2005", "17/02/2005", "18/02/2005", "19/02/2005",
>                                       "24/02/2005", "28/02/2005", "01/03/2005", "07/03/2005", "08/03/2005", "09/03/2005", "14/03/2005",
>                                     "16/03/2005", "25/03/2005", "01/04/2005", "06/04/2005", "07/04/2005", "08/04/2005", "13/04/2005",
>                                       "14/04/2005", "27/04/2005", "01/05/2005", "07/05/2005", "08/05/2005", "16/05/2005", "30/05/2005",
>                                     "06/06/2005"), main = 'Females 2005', ylab = 'Age/Days', xlab = 'Birth/Hatch date')
>
> Many thanks
> Vasana
> Sent from Mail for Windows 10
>
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-sig-Geo mailing list