It also mentioned that no other plotting packages from R or python can generate graphs that have the same high image quality as those generated by pgfplots in LaTeX directly, but no examples or reasons were given. Is there evidence to back up this claim?
With respect R (phyton ignorant here!), there are a huge evidence of its ability to make of almost any type of graphs. As a small sample, the R graph gallery seem enough.
With respect to the printing quality, R can make graphs in bitmap formats (png, jpeg, bmp, tiff) than of course could have a poor quality when zoomed excessively in LaTeX or in another format, but the
grDevices documentation states than R can also make vectorial images in xfig, ps, wmf, pdf and that other packages can include other devices outputting SVG and PGF/TiKZ, and even TeX/PicTeX files "(of historical interest only)".
To be practical, let's focus in PDF format: Are vectorial images that can be included directly in LaTeX documents, so the printing quality will by only limited by the printer resolution in dpi. But also can include LaTeX expressions in labels of R plots using R functions as
The only question then could be that sans serif default font of labels and axis of R plots does not match with the default roman "Computer Mode" font of LaTeX text. This could be regarded as a good "feature" (I really like a different font for plots) or a terrible "bug". In the last case, one solution could be change the PDF font type in R. In my Linux system, that could be one of ...
 "serif" "sans" "mono"
 "AvantGarde" "Bookman" "Courier"
 "Helvetica" "Helvetica-Narrow" "NewCenturySchoolbook"
 "Palatino" "Times" "URWGothic"
 "URWBookman" "NimbusMon" "NimbusSan"
.... etc .....
So I can make:
> par(family="Palatino") # For example
> plot(c(1,2,3),main="Plot with Times font")
This is only a example. It is also possible use any TT or OTF font in other ways. In any case, if that font does not match exactly with the LaTeX font, of course you can also change the LateX font, even to the same TT or OTF font using
But if the look and feel do not match still enough, or simply you do want to deal with fonts in one or both sides, a simpler solution is use
knitr with the
tikz device. The main reason of
knitr is be better than
Sweave embedding R source in LaTeX documents.
For those that do not know what I'm talking about, just explain that this mixed document (LateX+R) usually have the
.Rnw extension (mean "R noweb" format) and can be exported by R to a pure LaTeX document (the
.tex version) where the R code is replaced by the R output (optionally with echo of source R code, beautifully highlighted) that can be processed by LaTeX compilers as usually (with Rstudio editor all the process is just press one button). This means that if the data changed, just a new export-compilation of the document will update all plots, and always in concordance with any tables and text results generated automatically by R.
With respect to the examples of R plots, there are many in this, somo site using
knitr and the
tikz device, as this 2D plot and these
3D (or 4D) plots (sorry for the autocites).
Beside be scalable images with LaTeX fonts, that LaTeX+R approach with a powerful statistical environment behind the scenes is a main reason to go with R plots, as this allow a reproducible research.
With respect python (phyton ignorant here!) I can say only that
is able to manage chunks of python (see Can we import Python file in latex? ) in a
.Rnw file, so probably similar considerations can be made about their plots.
knitryou can use a tikz device, so the R plot can also match the LateX fonts in this way (example here). Therefore, I use pgfplots or tikz directly only when I do not kown an easier method in R.
sagetexpackage gives you access to a computer algebra system as well as Python/matplotlib for calculations and/or graphing. This can give computer generated graphs for your LaTeX document or, to make everything pretty, you can force the calculations into tikz/pfgplots. See my answers to graphing Riemann Zeta and Cantor functions for comparison.