7

I use the Epilog option in order to print in the vertical axes a label between 0 and 20 as follows

Plot[x^2, {x, -10, 10}, Frame -> True, Epilog -> {Text[
Style["S", FontFamily -> "Helvetica", Black, Bold, 20], {-12, 
 10}]}]

enter image description here

However, the label is not shown in the plot. I also used ImagePadding to create more white space at the left right of the plot but without result. Any suggestions how to print this label? I don't want to use custom ticks.

Vaggelis_Z
  • 8,740
  • 6
  • 34
  • 79
  • 1
    You are telling it to put the text at {-12,10} but you are saying the plot range should be {-10,10} ? So it will not show up. Try Plot[x^2, {x, -13, 10}, Frame -> True, Epilog -> {Text[Style["S", FontFamily -> "Helvetica", Black, Bold, 20], {-12, 10}]}] – Nasser Oct 10 '14 at 06:52
  • 5
    Guys, wadr, imho, this question is not a simple mistake nor can easily be found in the documentation. It is a clearly stated question - one of the better ones in that -- and, there is no obvious solution i know of in the documentation or on this site. In fact, I have struggled with the same problem off and on until I bumped into ImagePadding/PlotRangeClipping combination -- and that only in the last two hours and thanks to this question. – kglr Oct 10 '14 at 09:53

3 Answers3

9

Use ImagePadding with a large enough value and set the option PlotRangeClipping to False:

Plot[x^2, {x, -10, 10}, Frame -> True,
 Epilog -> {Text[Style["S", FontFamily -> "Helvetica", Black, Bold, 20], {-12,10}]},
 ImagePadding -> 30, PlotRangeClipping -> False]

enter image description here

kglr
  • 394,356
  • 18
  • 477
  • 896
0

The problem is that an infinite arrangement of labels exists and I doubt any degree of programming can offer all that a user can imagine. If one does not like the straightforward result of FrameLabel, as in Plot[x^2, {x, -10, 10}, Frame -> True, FrameLabel -> {None, Style["S", FontFamily -> "Helvetica", Black, Bold, 20], None, None}] (which has the label reading upward and in the middle of the frame), then I would switch to placing graphics primitives inside a Graphics command, such as line = Line@Table[{x, x^2}, {x, -10, 10, .05}]; axes = {Line[{{-10, 0}, {10, 0}}], Line[{{0, 0}, {0, 100}}]}; Graphics[{line, Thickness[.007], axes, Text[Style["S", FontFamily -> "Helvetica", Black, Bold, 20], {-12, 10}]}, AspectRatio -> 1/GoldenRatio]. This lets you get exactly what you want at the cost of additional Table loops for curves, ticks, and such.

Nicholas G
  • 1,981
  • 10
  • 15
0

You can also consider using Overlay function with proper coodrinates.

maybe like this:

Overlay[{Plot[x^2, {x, -10, 10}, Frame -> True], 
Style["S", FontFamily -> "Helvetica", Black, Bold, 20]}, 
Alignment -> Bottom]

enter image description here

I don't know is there any method to control the relative location of objects overlayed?

Harry
  • 2,715
  • 14
  • 27
funnyp0ny
  • 1,905
  • 14
  • 21