1
$\begingroup$

I want to plot a figure with $\LaTeX$ formulas as labels. A simple example looks like the following:

<<MaTeX`
Plot[Sin[x], {x, 0, 2 \[Pi]}, Frame -> True, FrameLabel -> (MaTeX /@ {"x", "\\rm{sin}(x)"})]

However, the labels sin(x) and x are too small in the figure for me and I want larger ones. How can I adjust their sizes?

In another case if the label is a figure, like

fig = Plot[Sin[x], {x, 0, 2 \[Pi]}, Frame -> True];
Export["test.pdf", fig];
lab = Import["test.pdf"] // First;
DeleteFile["test.pdf"];
Plot[Sin[x], {x, 0, 2 \[Pi]}, Frame -> True, FrameLabel -> {None, lab}]

Again, how do I adjust the label size?

$\endgroup$
1
  • $\begingroup$ You can set the font size for MaTeX, Plot[Sin[x], {x, 0, 2 \[Pi]}, Frame -> True, FrameLabel -> MaTeX[{"x", "\\sin x"}, FontSize -> 18]]. \sin x is better than using \rm. $\endgroup$ – Szabolcs Apr 25 at 15:21
2
$\begingroup$

According to the documentation, there are two options that will affect the size of labels; you can also adjust the size of the plot to have the labels appear larger.

<< MaTeX`
SetOptions[MaTeX, "FontSize" -> 14, "Magnification" -> 1.2];
Plot[Sin[x], {x, 0, 2 \[Pi]},
 Frame -> True, FrameLabel -> (MaTeX /@ {"x", "\\rm{sin}(x)"}),
 ImageSize -> 250]

enter image description here

For your second example just use ImageSize when creating the label.

fig = Plot[Sin[x], {x, 0, 2 \[Pi]}, Frame -> True, ImageSize -> 120];
Plot[Sin[x], {x, 0, 2 \[Pi]}, Frame -> True, 
 FrameLabel -> {None, fig}]

Again, if your label is any image object you can use Show with a size option:

pic = (* some picture goes here *)
Plot[Sin[x], {x, 0, 2 \[Pi]}, Frame -> True, 
 FrameLabel -> {None, Show[pic, ImageSize -> Small]}]

enter image description here

$\endgroup$
2
  • $\begingroup$ What if the figure is the photo from my cellphones or any other source? I know that I can use ImageSize to control the label size in the wolfram system but I want to know how to deal with a general case. $\endgroup$ – Jie Zhu Apr 25 at 9:47
  • $\begingroup$ @Jie see my edit $\endgroup$ – A.G. Apr 25 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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