
MWE:
\documentclass{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\begin{document}
\begin{tikzpicture}
\begin{groupplot}[
group style={
group size=1 by 4,
vertical sep=0.1in,
},
scale only axis,
width=\columnwidth-0.5in-0.09in,
domain=-0.482362:0.035276,
xmin=-0.495, xmax=0.0352762,
]
\nextgroupplot[
height=0.8in,
ymin=-0.9, ymax=4.9,
]
\addplot
gnuplot[id=plot1, raw gnuplot]
{plot '< plotpointreduce -t 0.0175 --max-dist 0.1
--width 2.897 --height 0.8
--xrange \pgfkeysvalueof{/pgfplots/xmin} \pgfkeysvalueof{/pgfplots/xmax}
--yrange \pgfkeysvalueof{/pgfplots/ymin} \pgfkeysvalueof{/pgfplots/ymax}
--x-column delta --y-column v_12 data_fem_0.dat' u 'delta':'v_12'}
;
\end{groupplot}
\end{tikzpicture}
\end{document}
Wie kann ich die angegebenen Werte für die Achsenbreite (\columnwidth-0.5in-0.09in) und -höhe (0.8in) in den groupplot
und \nextgroupplot
Optionen ähnlich wie bei --xrange
und an meinen Roh-Gnuplot-String übergeben --yrange
?
Das Skript plotpointreduce
erwartet einheitenlose Gleitkommazahlen für --width
und --height
, es wird nur das Verhältnis berücksichtigt.
Aktualisieren:
Ich habe den Aufruf geändert in:
\addplot
gnuplot[id=plot1, raw gnuplot]
{plot '< plotpointreduce -t 0.0175 --max-dist 0.1
--width \pgfkeysvalueof{/pgfplots/width}
--height \pgfkeysvalueof{/pgfplots/height}
--xrange \pgfkeysvalueof{/pgfplots/xmin} \pgfkeysvalueof{/pgfplots/xmax}
--yrange \pgfkeysvalueof{/pgfplots/ymin} \pgfkeysvalueof{/pgfplots/ymax}
--x-column delta --y-column v_12 data_fem_0.dat' u 'delta':'v_12'}
;
\pgfkeysvalueof{/pgfplots/width}
Gibt jedoch zurück \columnwidth -0.5in-0.09in
.
Wie kann ich dies in den tatsächlichen Wert in umwandeln inch
?
Ich habe das lange, selbst geschriebene Skript plotpointreduce
aufhttps://gist.github.com/Hotschke/afdcd9efabe385c641a6.
Aktualisierung II
--width \the\pgfkeysvalueof{/pgfplots/width}
\the
erweitert die Spaltenbreite.
Mein Skript beschwert sich immer nochplotpointreduce: error: argument -w/--width: invalid float value: '345.0pt-0.5in-0.09in'
Meine Frage betrifft also vermutlich lediglich die Erweiterung dieses Ausdrucks. Was ist der kürzeste Weg, dies zu tun?
Antwort1
Nach weiterer Internetsuche konnte ich es herausfinden. Ich weiß nicht, ob dies die zuverlässigste Methode ist:
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}
\usepgfplotslibrary{groupplots}
\makeatletter
\def\Printdimensionless#1{\strip@pt \dimexpr (#1)\relax}
\makeatother
% For convenience
\newcommand{\pwidth}{\Printdimensionless{\pgfkeysvalueof{/pgfplots/width}} } % trailing space important
\newcommand{\pheight}{\Printdimensionless{\pgfkeysvalueof{/pgfplots/height}} }
\newcommand{\pxrange}{\pgfkeysvalueof{/pgfplots/xmin} \pgfkeysvalueof{/pgfplots/xmax} }
\newcommand{\pyrange}{\pgfkeysvalueof{/pgfplots/ymin} \pgfkeysvalueof{/pgfplots/ymax} }
\begin{filecontents}{data_fem_0.dat}
id delta E_1 E_2 v_12 v_21 G_12 err porosity E_cs_1_norm E_cs_2_norm
049 -0.48 2.6891 2.9098 0.33942 0.36728 1.1087 0.010752 0.914955 0.89481 0.968249
047 -0.46 0.014184 0.1251 -0.3269 -2.8832 0.71385 0.0011567 0.88558 0.00343525 0.0302982
\end{filecontents} % inserts '%' comment lines
\begin{document}
\begin{tikzpicture}
\begin{groupplot}[
group style={
group size=1 by 2,
vertical sep=0.1in,
},
scale only axis,
width=\columnwidth-0.5in,
domain=-0.482362:0.035276,
xmin=-0.495, xmax=0.0352762,
]
\nextgroupplot[
height=0.8in,
ymin=-0.9, ymax=4.9,
]
\addplot
gnuplot[id=poisson12, raw gnuplot]
{set datafile commentschars '#\%';
\addplot
gnuplot[id=young1, raw gnuplot]
{plot '< plotpointreduce -t 0.0
--width \pwidth --height \pheight
--xrange \pxrange --yrange \pyrange
-x delta -y E_cs_1_norm ./data_fem_0.dat' u 'delta':'v_12'}; 'delta':'v_12'}
;
\nextgroupplot[
height=0.8in,
ytick={0,0.5,1},
ymin=0, ymax=1,
]
\addplot
gnuplot[id=young1, raw gnuplot]
{set datafile commentschars '#\%';
plot '< plotpointreduce -t 0.0
--width \pwidth --height \pheight
--xrange \pxrange --yrange \pyrange
-x delta -y E_cs_1_norm ./data_fem_0.dat' u 'delta':'E_cs_1_norm'};
\end{groupplot}
\end{tikzpicture}
\end{document}
Hilfreiche Antworten: