# Integrating R or python plots to latex document

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. 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.