3

Consider the following code.

f[x_] := Sin[x];
Plot[f[x], {x, 0, 2*Pi}, 
  PlotRange -> {{0, 2*Pi}, {-2, 2}}, 
  Axes -> False, Frame -> True, FrameStyle -> Black, 
  FrameLabel -> {Style["x", FontSize -> 18], Style["sin(x)", FontSize -> 18]}, 
  LabelStyle -> Directive[FontFamily -> "Times New Roman", 14], 
  ImagePadding -> {{Automatic, 15}, {Automatic, 10}}, 
  FrameTicks -> {{{-2, 0, 2}, None}, {{0, \[Pi], 2 \[Pi]}, None}}, 
  FrameStyle -> Directive[Black, Thickness[0.003]], 
  RotateLabel -> False]

enter image description here

I want to expand the gap between the frame label and the frame, namely the gap occupied by the red rectangle below.

enter image description here

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
Bo Zhu
  • 65
  • 6

1 Answers1

3

Use Spacings inside Labeled

Labeled[Plot[f[x], {x, 0, 2*Pi}, PlotRange -> {{0, 2*Pi}, {-2, 2}}, 
  Axes -> False, Frame -> True, FrameStyle -> Black, 
  ImagePadding -> {{Automatic, 15}, {Automatic, 10}}, 
  FrameTicks -> {{{-2, 0, 2}, None}, {{0, \[Pi], 2 \[Pi]}, None}}, 
  FrameStyle -> Directive[Black, Thickness[0.003]], 
  RotateLabel -> False], 
 TraditionalForm /@ {Sin[x], x}, {Left, Bottom}, 
 Spacings -> {5, 0}]

enter image description here

zhk
  • 11,939
  • 1
  • 22
  • 38