3

When plotting with custom labels, the ticks on both axes can overlap:

Plot[x, {x, 0, 1}, Frame -> {{True, False}, {True, False}}, 
      FrameTicks -> {{{{0, Rotate["Low", Pi/2]}, 
                       {1,Rotate["High", Pi/2]}}, None}, {{{0, "Low"}, {1, "High"}}, None}}, 
      LabelStyle -> 20, PlotRange -> {{0, 1}, {0, 1}}]

enter image description here

I know I can use ImageMargins to fix it ad-hoc as discussed in this thread

Plot[x, {x, 0, 1}, Frame -> {{True, False}, {True, False}}, 
      FrameTicks -> {{{{0, Rotate[Pane["Low", ImageMargins -> {{20, 0}, {0, 0}}], Pi/2]}, 
                       {1, Rotate["High", Pi/2]}}, None}, 
                     {{{0, Pane["Low", ImageMargins -> {{20, 0}, {0, 0}}]}, {1, "High"}}, None}}, 
      LabelStyle -> 20, PlotRange -> {{0, 1}, {0, 1}}]

enter image description here

but this is very much contingent on current settings of font size etc., so I was wondering if there is a way to actually use left justify to make it always work.

Stitch
  • 4,205
  • 1
  • 12
  • 28

1 Answers1

5

A very simple, low-tech solution is put spaces into the "Low" labels. Like so:

Plot[x, {x, 0, 1},
  Frame -> {{True, False}, {True, False}}, 
  FrameTicks -> 
    {{{{0, Rotate["      Low", Pi/2]}, {1, Rotate["High", Pi/2]}}, None}, 
     {{{0, "      Low"}, {1, "High"}}, None}},
  LabelStyle -> 20,
  PlotRange -> {{0, 1}, {0, 1}}]

plot

m_goldberg
  • 107,779
  • 16
  • 103
  • 257