3
$\begingroup$

Consider

Plot[Sin[x], {x, 0, 2 π}, Frame -> True, 
 FrameLabel -> {Style["x", FontSize -> Scaled[0.05]], Style["sin(x)", FontSize -> Scaled[0.05]]}, 
 FrameTicksStyle -> Scaled[0.02]]

enter image description here

The label $\sin(x)$ is cropped from the left. Adding PlotRangePadding -> {0, .5} as a brutal fix seems to work:

enter image description here

but it obviously alters the plot range as it is intended to do. This can't be circumvented with PlotRange as it's overwriten.

How to prevent the cropping?

$\endgroup$
1
  • $\begingroup$ Related: (7453) $\endgroup$
    – Mr.Wizard
    Mar 23, 2017 at 15:21

1 Answer 1

3
$\begingroup$

Add Framed around the problematic piece. Update: It seems you can also use Pane (see comments).

Framed is not only for drawing frames. It is also for controlling the box that contains the expression. You can eliminate the border with FrameStyle -> None. Other relevant options are ContentPadding and FrameMargins. Note that in the latter, negative values are allowed too, which will let you effectively control the box placement (move it closer to the graphics frame).

However, if your aim is to scale graphics proportionally, I recommend using Magnify instead of making all units scaled.

$\endgroup$
2
  • 2
    $\begingroup$ So maybe Pane to not care about options. $\endgroup$
    – Kuba
    Mar 22, 2017 at 11:11
  • $\begingroup$ @Kuba Hm, good point ... I cannot see what may go wrong with Pane. I have always used Framed for such things. As I remember, some builtin stuff also uses it (well, FrameBox to be precise). SciDraw makes heavy use of Framed too, for this very purpose. So it is proven to work. I will try using PaneBox in the future to discover if it has any problems. $\endgroup$
    – Szabolcs
    Mar 22, 2017 at 11:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.