1
votes

Try as I might, I can't seem to get qplot to print an x axis label when using facets. Reproducible toy example (requires diamonds dataset which I think comes with ggplot2):

dsmall <- diamonds[sample(nrow(diamonds), 100), ]
qplot(color,price,data=dsmall ,facets=cut~.,xlab="TEST")

How do I add an x axis label to this?

1
Reproducible example? Can you dput() the data used or make up some dummy data? - Gavin Simpson
Well that works for me., I get a bog fat "TEST" on the x-axis. Perhaps you could add the output from sessionInfo() to your Q. Are you running an up-to-date version of ggplot2? - Gavin Simpson
Your updated code works well, i.e. the xlab gets displayed correctly. - Andrie
Well this is embarrassing -- seems like no one else has the issue. Let me completely reinstall R on my Mac and try again (wonder if it's a Mac-only issue). - Victor Van Hee

1 Answers

1
votes

Resize the window (just make it a hair smaller by clicking on the lower right corner and dragging a bit) or save the plot as a PDF to see the x axis label.

I think this may be a bug in the Mac version of R. Maybe a Lion issue with its fancier windows? Doesn't seem like anyone else is noticing this problem. Would be nice to get confirmation from someone else using the Mac R64 binary 2.15.0 with ggplot2 0.9.1 on Mac OS X 10.7.4, and I'll submit a bug report.

Before resizing the Quartz window: plot with no apparent x axis label After resizing, the label magically appears: plot with x axis label