pdf crop using python
pip install pdfCropMargins --upgrade
pdf-crop-margins -p 0 two_hop_cdf.pdf
in matlab, the following command is best:
exportgraphics(gcf, 'output.pdf', 'ContentType', 'vector');
The above command can also avoid the following warnings:
Warning: The figure is too large for the page and will be cut off. Resize the figure, adjust the output size by setting the figure's PaperPosition property, use the 'print' command with either the '-bestfit' or '-fillpage' options, or use the 'Best fit' or 'Fill page' options on the 'Print Preview' window.