Consider the two following similar expressions:
(* EXPRESSION 1 *)
Plot[Sin[x], {x, 0, 2 Pi}, Frame -> True, PlotRange -> Automatic,
PlotLabel -> Style["PLOT LABEL", FontSize -> Medium, FontWeight -> Bold]]
(* EXPRESSION 2 *)
Plot[Sin[x], {x, 0, 2 Pi}, Frame -> True, PlotRange -> Automatic, PlotRangePadding -> 0,
PlotLabel -> Style["PLOT LABEL", FontSize -> Medium, FontWeight -> Bold]]
the only difference between them being the PlotRangePadding -> 0
option.
The first expression produces this result:
while the second one returns the following image:
As you can see, the distance of the text "PLOT LABEL" is different in each case.
I guess that the distance between the plot label and the plot does not take into account the plot padding. Why is this happening? How can I avoid this behaviour? More precisely, how can I increase the distance between the plot label and the plot in case 1?
In case it matters, I am using Mathematica 10.4.1 running on Windows 7.
Labeled[plot, Style["PLOT LABEL", {"Graphics", "GraphicsLabel", FontSize -> Medium, FontWeight -> Bold}], Top]
, but it is centered along the image center line, not theGraphics
center line (subtle, but noticeable). TheAlignment
option could be used to further adjust it, but I don't have the time at the moment. $\endgroup$Labeled
is an option, of course. But I wonder whether or not it is possible to have a more consistent/coherent behaviour of thePlotLabel
option. $\endgroup$PlotLabel
is fairly low-level, i.e. it is handled by the renderer itself, so you have to get "creative". Here's something that works quite well:PlotLabel -> Pane[Style["PLOT LABEL", FontSize -> Medium, FontWeight -> Bold], {Automatic, 20}, Alignment -> {Center, Top}]
. Let me know if that works for you, and I'll convert it to an answer. $\endgroup$PlotRangePadding -> 0
is now acceptable but still different to that obtained when usingPlotRangePadding -> 0
. I have a pair of charts, one of each type, and I would like the corresponding labels to be the same distance from their respective chart. Anyway, you can post it as an answer, and we can wait and see. $\endgroup$