Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% MWE for SX: Defining variables with numbers taken from a file
- documentclass{standalone}
- usepackage[utf8]{inputenx}
- usepackage[T1]{fontenc}
- %% Use only sans-serif fonts; change to serif if desired
- renewcommand*sfdefault{phv}
- renewcommand*{familydefault}{sfdefault}
- usepackage{arevmath}
- usepackage{tikz}
- usepackage{pgfplots}
- pgfplotsset{compat=newest}
- usepgfplotslibrary{units}
- usetikzlibrary{spy, backgrounds}
- usepackage{pgfplotstable}
- usepackage{xcolor}
- usepackage{amsmath}
- %% To read variables from file
- usepackage{datatool}
- usepackage{filecontents}
- newlengthfigurewidth
- newlengthfigureheight
- newlengthmarksize
- begin{document}
- %% Width and height of the output figure, adapt as necessary
- setlength{figurewidth}{13cm}
- setlength{figureheight}{8cm}
- setlength{marksize}{2.4pt}
- setlength{linewidth}{1pt}
- %% Define the file in here, as whole files cannot be uploaded to Tex.SE
- begin{filecontents}{LsqExponents.csv}
- 4.012,3.456,2.345
- end{filecontents}
- %% Now read these three values from the file
- DTLloaddb[noheader, keys={b_annu, b_rest, b_stra}]{LsqExponents}{LsqExponents.csv}
- %DTLdisplaydb{LsqExponents}
- begin{tikzpicture}[font=large]
- begin{axis}[%
- width=figurewidth,
- height=figureheight,
- scale only axis,
- xmin=0.05,
- xmax=0.5,
- xtick={0.1,0.2,0.3,0.4,0.5},
- xlabel={$text{T G S } gamma_mathrm{g} text{ (-)}$},
- %xmajorgrids,
- ymin=0,
- ymax=0.12,
- ylabel={$text{G R P } h_mathrm{g} text{ (-)}$},
- yticklabel style={/pgf/number format/fixed,
- /pgf/number format/precision=2,
- /pgf/number format/fixed zerofill},
- %ymajorgrids,
- name=plot1,
- legend pos=north west,
- legend style={anchor=north west,draw=black,fill=white,legend cell align=left, rounded corners=2pt, nodes={inner sep=4pt,text depth=0pt}}
- ]
- %% Fits and functions
- addplot [color=cyan, solid, domain=0:0.5] {x^4.567};
- addlegendentry{Original TD Fit};
- addplot [color=magenta, dashed, domain=0:0.5] {x^3.456};
- addlegendentry{TD-like Fit for Rest};
- addplot [color=black, dashed, domain=0:0.5] {x^2.345};
- addlegendentry{TD-like Fit for Stra};
- end{axis}
- end{tikzpicture}
- end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement