MATLAB Figure and LATEX

24 views (last 30 days)
Brave A
Brave A on 7 Mar 2021
Commented: Jorg Woehl on 7 Mar 2021
Hi,
I produced some figures using MATLAB but when I add them into (Latex documnet) , it looks very small. I tried to increase font for text and legend but the problem still the there.
I attached one example figure. Thanks in advance!
  4 Comments
Brave A
Brave A on 7 Mar 2021
Any thoghts?
Star Strider
Star Strider on 7 Mar 2021
I have no recent experience with preparing LaTeX documents, so unfortunately, no.
I’m hoping that someone with relevant experience will see this and can help you solve this. Perhaps posting an image of the document, or uploading the document itself (probably as a .zip file if the native file format isn’t supported on MATLAB Answers) would be helpful.

Sign in to comment.

Answers (1)

Jorg Woehl
Jorg Woehl on 7 Mar 2021
I'm not sure what the issue is, but your figure displays just fine when I save it to a png file (my preferred graphics file format) and then insert it into a LaTeX document. Here is a minimal working example:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering
\includegraphics[scale=0.25]{test.png}
\caption{your caption text}
\end{figure}
\end{document}
I usually scale figures down by 50%, but that wasn't quite enough in this case.
The output on a letter-size page is shown below (produced using Overleaf, by the way):
  2 Comments
Brave A
Brave A on 7 Mar 2021
Do you have latex code for subfigures?
I added them but they are overlapping. Also in your example the picture not show everything.
Jorg Woehl
Jorg Woehl on 7 Mar 2021
What do you mean exactly by "not showing everything"? As far as I can tell, everything is there from your original figure: axis labels, ticks and tick marks, grid, legend, data points and plots...
If you want to insert a picture of the entire figure window (with menu bar etc.), you would need to take a screenshot and insert that into your LaTeX document.
I am not sure if LaTeX can handle subfigures; my suggestion would be to first make a composite figure either in MATLAB itself (use subplot or tiledlayout) or an external drawing app, and insert this into your LaTeX document.

Sign in to comment.

Categories

Find more on Printing and Saving in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!