I have concern towards font used in latex. I would like to have consistent font in pdf/png and main document. I am using R currently, which is not a very good option, see (this or this; same post though). I don't want to create a tex file for each plot and then include in the main document. It increases the size and compile time unnecessarily.

Now, I am thinking to use python to plot and then integrate it with latex document. I have never used python before. From this link, it looks that integration is possible.

Obviously, I can plot with the later option and see myself, however, most of the my plots have higher complexities and I would like to get some opinions from experts here before investing time to python.

What are the pro and cons of using python with latex document over R with latex?

Any pointer will also be very helpful.

  • You may also be interested in pgfplots.
    – JPi
    Aug 3 '16 at 13:00
  • If you do choose to use Python, my pythontex package might be useful. The gallery doc has a basic plotting example.
    – G. Poore
    Aug 3 '16 at 15:12

Python's matplotlib can use LaTeX in things like axis labels, then export to pdf which you can use with \includegraphics. If you stick to common fonts you have a good chance of using the same ones according to the options you linked. Computer Modern is the default making it even easier.

I have to admit that matplotlib isn't the easiest bit of Python for a novice to get started on. I don't have any experience of R so won't comment on that.

One thing I have found in the past is that text in figures can get very small, and be rotated to vertical. Especially in combination, this doesn't work very well for serif fonts, so I tend to use sans serif in figures even when the body is in Latin Modern. This still fits with your question, as for all know you're using sans serif anyway.

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.