MichaelChirico / r-bugs

A ⚠️read-only⚠️mirror of https://bugs.r-project.org/
20 stars 0 forks source link

[BUGZILLA #10345] boxplot() confuses x- and y-axes #3189

Open MichaelChirico opened 4 years ago

MichaelChirico commented 4 years ago

From: bob.ohara@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::> Full_Name: Bob O'Hara Version: 2.6.0 OS: Windows XP Submission from: (NULL) (88.112.20.250)

Using horizontal=TRUE with boxplot() confuses it as to what is an x- or y-axis. At least, xlim= and ylim= are the wrong way round, log="x" (or "y") and xaxt= work as expected, I haven't looked at anything else.

Some code to see if you can reproduce the bug (or discover it's in my head...):

boxplot(count∼ spray, data = InsectSprays)

# Try to change x-axis: boxplot(count∼ spray, data = InsectSprays, xlim=c(0,50))

# Plot horizontally: boxplot(count∼ spray, data = InsectSprays, horizontal=TRUE)

# Now try to change x-axis: boxplot(count∼ spray, data = InsectSprays, horizontal=TRUE, xlim=c(0,50)) # Changes y-axis!

# Now try to change y-axis: boxplot(count∼ spray, data = InsectSprays, horizontal=TRUE, ylim=c(0,50)) # Changes x-axis!

# Plot x-axis on log scale: boxplot(count+1∼ spray, data = InsectSprays, horizontal=TRUE, log="x") # Does indeed change x-axis

# Don't add ticks on x-axis: boxplot(count∼ spray, data = InsectSprays, horizontal=TRUE, xaxt="n") # Works as expected.


METADATA

MichaelChirico commented 4 years ago

From: "hadley wickham" <h.wickham@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>>

So given the help file, we should consider dropping the whole
``along the boxplot'' idea?

{{well, yes, we should drop "traditional graphics" and work with
grid-based graphical objects ("grob"s) that can be drawn
vertically or horizontally,
e.g., in lattice or (most probably) ggplot2
}}

ggplot2 does this in a completely general way (i.e. for all types of graphics) with the coord_flip coordinate system, which flips the interpretation of the x and y scales. This includes producing smoothers of x conditional on y, and so forth.

Hadley

-- http://had.co.nz/


METADATA

MichaelChirico commented 4 years ago

NOTES: as docuemnted, if not ideal


METADATA

MichaelChirico commented 4 years ago

Audit (from Jitterbug): Tue Oct 16 13:47:05 2007 ripley moved from incoming to Graphics Mon Dec 15 17:59:03 2008 ripley changed notes Mon Dec 15 16:59:03 2008 ripley moved from Graphics to wishlist


METADATA