0

I just wonder can we use ggplot to have two labels of names for x axis (vertically)?

Here is what I want:

I want to have one label name, for example "discount", and have breaks and a histogram for "discount", and I also want to have another x-axis below the histogram, and showing label name, "price", and only showing this x axis and the breaks (not another histogram, and the breaks are same as the "discount"). -- Like a histogram with two x-axis with different label names and same breaks.

Is this doable?

user213544
  • 2,046
  • 3
  • 22
  • 52
Ian
  • 157
  • 1
  • 7
  • 1
    You should look into ggplot's `sec_axis` (or explain why it doesn't work for you). – r2evans Jan 30 '20 at 21:05
  • 1
    This sounds like a use case for facets. But it's difficult to help without example data and a clearer picture of the desired output. – neilfws Jan 30 '20 at 21:12
  • 1
    [See here](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) on making an R question that folks can help with. That includes a sample of data, all necessary code, and a clear explanation of what you're trying to do and what hasn't worked. – camille Jan 30 '20 at 22:05

0 Answers0