TransWikia.com

fit the plot to the entire page in pgfplots

TeX - LaTeX Asked by Gagik on March 31, 2021

I use PGFPlots to create graphs and export them into my keynote slides. I always have to trim the sides of the exported pdf file. Attached is an example of such a graph.enter image description here I wonder if there is a way to automatically fit the plot into the whole page in the pdf file?

Here is the code that produces the graph

documentclass[a4paper]{article}

usepackage{amsmath}
usepackage{xcolor}
usepackage{pgfplots}
usepackage{pgfplotstable}%fitting functions
usepackage{tikz}
usetikzlibrary{tikzmark,patterns,pgfplots.fillbetween}

pagestyle{empty}

pgfkeys{/pgf/number format/.cd,fixed}

pgfplotsset{compat=1.15}
pgfplotsset{label style={font=LARGE},
            tick label style={font=LARGE}}

pgfplotsset{error bars/.cd,
    x dir=both, x explicit,
    y dir=both, y explicit,
    }

begin{document}


begin{figure}
centering
begin{tikzpicture}
begin{axis}[
    enable tick line clipping=false, % makes all ticks same width
    axis line style=semithick,
    width=14cm,
    height=7cm,
    x tick style={black,semithick},
    x label style=
        {at={(ticklabel cs:0.5)},anchor=near ticklabel},
    xlabel={$L$ [mm]},
    xmin=0,xmax=100,
    xtick={0,20,...,100},
    xtick pos=bottom,
    xtick align=outside,
    y tick style={black,semithick},
    y label style=
        {at={(ticklabel cs:0.5)},anchor=near ticklabel},
    ylabel={$F$ [N]},
    ymin=-0.05,ymax=0.2,
    ytick={-0.05,0,...,0.25},
    ytick pos=left,
    ytick align=outside,
]
    addplot [only marks,mark=*,mark options={scale=0.5,red,fill=white}] file {LDPE_PETG_2.txt};

    addplot [only marks,mark=*,mark options={scale=0.5,blue,fill=white}] file {LDPE-DOTO_PETG_2.txt};

end{axis}
end{tikzpicture}
end{figure}

end{document}

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP