[R] reversing the order of a y-axis in stripchart()

Rui Barradas ruipbarradas at sapo.pt
Thu Jun 21 21:57:21 CEST 2012


Hello,

You should post a data example using

dput(head(X, 20))  # or 30

Now, for your question, you can simply set ylim to the reverse order. 
Using one of the examples in the stripchart help page,


op <- par(mfrow=c(1, 2))
# First graph, y axis in reversed order
plot(1, typer="n", xlim=c(0, 9), ylim=c(130, 2))
stripchart(decrease ~ treatment,
     main = "stripchart(OrchardSprays)",
     vertical = TRUE, log = "y", data = OrchardSprays, add=TRUE)
# Second graph, exactly like in ?stripchart
stripchart(decrease ~ treatment,
     main = "stripchart(OrchardSprays)",
     vertical = TRUE, log = "y", data = OrchardSprays)
par(op)


Hope this helps,

Rui Barradas

Em 21-06-2012 18:56, Brianna Wright escreveu:
> Hi,
>
> I am trying to plot a graph using stripchart() - my x-axis is categorical
> and my y-axis is numerical. I would like to reverse the order of my y-axis
> (i.e. with 0 at the top left and increasing numbers moving downward towards
> the bottom left corner). My data are subsetted into 3 categories that I've
> plotted on 1 graph using stripchart(add=TRUE) option.
>
> Thanks for any assistance,
> Regards,
> - Brianna
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
>



More information about the R-help mailing list