1

I am trying to create a two-axis plot with error bars, using the overlay function. However, for some reason the tick labels don't render on the right hand axis and I have no idea why!

Needs["ErrorBarPlots`"]

data1 = {{{1, -40}, ErrorBar[0.5]}, {{3, -42}, 
    ErrorBar[0.5]}, {{5, -43}, ErrorBar[0.5]}};
data2 = {{{1, -20}, ErrorBar[0.5]}, {{3, -22}, 
    ErrorBar[0.5]}, {{5, -26}, ErrorBar[0.5]}};
data3 = {{{1, 19}, ErrorBar[0.5]}, {{3, 25}, ErrorBar[0.5]}, {{5, 30},
     ErrorBar[0.5]}};

p1 = ErrorListPlot[data1, ImagePadding -> 45, 
   Frame -> {True, True, True, False}, 
   FrameTicks -> {All, All, None, None}, GridLines -> Automatic, 
   ImageSize -> Large, PlotRange -> {{0, Automatic}, {-45, -15}}, 
   PlotStyle -> Red];

p2 = ErrorListPlot[data2, Axes -> False, ImagePadding -> 45, 
   ImageSize -> Large, PlotRange -> {{0, Automatic}, {-45, -15}}, 
   PlotStyle -> Green];

p3 = ErrorListPlot[data3, Axes -> False, ImagePadding -> 45, 
   Frame -> {False, False, False, True}, 
   FrameStyle -> {Automatic, Automatic, Automatic, Blue}, 
   FrameTicks -> {None, None, None, Automatic}, ImageSize -> Large, 
   PlotRange -> {{0, Automatic}, All}, PlotStyle -> Blue];

Overlay[{p1, p2, p3}]

I tested the individual plots and the ticks render for plots with axis on the left hand side, but not the right.

Any thoughts?

Karsten7
  • 27,448
  • 5
  • 73
  • 134
user27119
  • 2,500
  • 13
  • 34

0 Answers0