von Epllus » Mi 17. Jul 2013, 15:54
EDIT: Du hast \usepackage{amsmath} vergessen (wegen \text{}).
1. Kannst du nicht einfach „standalone“ nehmen?
\documentclass{standalone}
\usepackage{pgfplots}
\usepackage{amsmath}
\begin{document}
\begin{tikzpicture}
\begin{axis}[%
%width=\figurewidth,
%height=\figureheight,
scale only axis,
xmin=0,
xmax=2,
xlabel={magnetische Polarisation J (T)},
xmajorgrids,
ymin=0,
ymax=300,
ylabel={magnetische Feldstaerke H (A/m)},
ymajorgrids,
axis x line*=bottom,
axis y line*=left,
legend style={at={(0.290773809523807,0.747222222222222)},anchor=south west,draw=black,fill=white,legend cell align=left}
]
\addplot [
color=blue,
line width=1.5pt,
mark size=3.0pt,
only marks,
mark=x,
mark options={solid,draw=black}
]
table[row sep=crcr]{
0 0\\
0.0999666868591286 3.48640381318019\\
0.14994847246798 4.61545758657749\\
0.199985722669264 5.48153882560792\\
0.249949841413249 6.39065204517804\\
0.299947957010717 7.14801695446672\\
0.349953821967313 7.91036483703354\\
0.399976532272618 8.52659737026922\\
0.450097750416451 9.13621890136789\\
0.500022610367541 9.63197734173655\\
0.550018334435385 10.1329498121077\\
0.599967687953469 10.5707509577677\\
0.649996580770619 11.0279947217953\\
0.700015403928287 11.4202879317111\\
0.750007258685311 11.7990433971682\\
0.799945925236683 12.1930506739032\\
0.84995311550608 12.542250611286\\
0.899993657317734 12.8844553590562\\
0.949912640834382 13.2022877693952\\
0.999972604873861 13.5401286764703\\
1.0499570770376 13.8607421694059\\
1.09994829057387 14.1599136461373\\
1.14987942654735 14.4427675385012\\
1.19988794346681 14.7716403260394\\
1.24995188468364 14.8985475702352\\
1.29979652659269 15.226500203805\\
1.34983425117069 15.5640310456756\\
1.39974893534602 16.019359315911\\
1.44981366582721 16.522502237118\\
1.49989148955403 17.136983978165\\
1.54995414154466 17.9822738052251\\
1.59991842813564 19.2009912215814\\
1.6499318468167 21.1007535625428\\
1.69991355787277 23.9284939454521\\
1.74983108268398 28.7222470840893\\
1.79991418776028 37.9429567045855\\
1.84833135846112 56.4924941848908\\
1.89882983065378 107.241735116193\\
1.95070235650727 255.184198076309\\
};
\addlegendentry{$\text{a}_\text{1}$};
\addplot [
color=blue,
solid,
line width=1.5pt
]
table[row sep=crcr]{
0 0.304546535015106\\
0.0999666868591286 1.7608035504818\\
0.14994847246798 5.22279033064842\\
0.199985722669264 6.9700922369957\\
0.249949841413249 7.28277409076691\\
0.299947957010717 7.01095330715179\\
0.349953821967313 6.89152657985687\\
0.399976532272618 7.30086064338684\\
0.450097750416451 8.2534236907959\\
0.500022610367541 9.50975930690765\\
0.550018334435385 10.7519751787186\\
0.599967687953469 11.6963572502136\\
0.649996580770619 12.1910936832428\\
0.700015403928287 12.2382789850235\\
0.750007258685311 11.9800099134445\\
0.799945925236683 11.6412487030029\\
0.84995311550608 11.457008600235\\
0.899993657317734 11.6067721843719\\
0.949912640834382 12.1602535247803\\
0.999972604873861 13.0632727146149\\
1.0499570770376 14.140837430954\\
1.09994829057387 15.1534025669098\\
1.14987942654735 15.8583917617798\\
1.19988794346681 16.0904226303101\\
1.24995188468364 15.8203406333923\\
1.29979652659269 15.1997027397156\\
1.34983425117069 14.536256313324\\
1.39974893534602 14.2435127496719\\
1.44981366582721 14.7097660303116\\
1.49989148955403 16.153014421463\\
1.54995414154466 18.4720323085785\\
1.59991842813564 21.1917930841446\\
1.6499318468167 23.6313501596451\\
1.69991355787277 25.3865704536438\\
1.74983108268398 27.4215255975723\\
1.79991418776028 34.0121833086014\\
1.84833135846112 54.7073881626129\\
1.89882983065378 112.721429526806\\
1.95070235650727 253.296808421612\\
};
\addlegendentry{Funktion};
\end{axis}
\end{tikzpicture}%
\end{document}
2. Musst du ein prefix verwenden? Ohne geht es.
\documentclass{article}
\usepackage{pgfplots}
\usepackage{amsmath}
\usepgfplotslibrary{external}
\tikzexternalize
\begin{document}
\begin{figure}
\centering
\newlength\figureheight % define length \figureheight
\newlength\figurewidth % define length \figurewidth
\setlength\figureheight{6cm} % set \figureheight
\setlength\figurewidth{6cm} % set \figurewidth
\tikzsetnextfilename{test} % name next TikZ figure
\begin{tikzpicture}
\begin{axis}[%
width=\figurewidth,
height=\figureheight,
scale only axis,
xmin=0,
xmax=2,
xlabel={magnetische Polarisation J (T)},
xmajorgrids,
ymin=0,
ymax=300,
ylabel={magnetische Feldstaerke H (A/m)},
ymajorgrids,
axis x line*=bottom,
axis y line*=left,
legend style={at={(0.290773809523807,0.747222222222222)},anchor=south west,draw=black,fill=white,legend cell align=left}
]
\addplot [
color=blue,
line width=1.5pt,
mark size=3.0pt,
only marks,
mark=x,
mark options={solid,draw=black}
]
table[row sep=crcr]{
0 0\\
0.0999666868591286 3.48640381318019\\
0.14994847246798 4.61545758657749\\
0.199985722669264 5.48153882560792\\
0.249949841413249 6.39065204517804\\
0.299947957010717 7.14801695446672\\
0.349953821967313 7.91036483703354\\
0.399976532272618 8.52659737026922\\
0.450097750416451 9.13621890136789\\
0.500022610367541 9.63197734173655\\
0.550018334435385 10.1329498121077\\
0.599967687953469 10.5707509577677\\
0.649996580770619 11.0279947217953\\
0.700015403928287 11.4202879317111\\
0.750007258685311 11.7990433971682\\
0.799945925236683 12.1930506739032\\
0.84995311550608 12.542250611286\\
0.899993657317734 12.8844553590562\\
0.949912640834382 13.2022877693952\\
0.999972604873861 13.5401286764703\\
1.0499570770376 13.8607421694059\\
1.09994829057387 14.1599136461373\\
1.14987942654735 14.4427675385012\\
1.19988794346681 14.7716403260394\\
1.24995188468364 14.8985475702352\\
1.29979652659269 15.226500203805\\
1.34983425117069 15.5640310456756\\
1.39974893534602 16.019359315911\\
1.44981366582721 16.522502237118\\
1.49989148955403 17.136983978165\\
1.54995414154466 17.9822738052251\\
1.59991842813564 19.2009912215814\\
1.6499318468167 21.1007535625428\\
1.69991355787277 23.9284939454521\\
1.74983108268398 28.7222470840893\\
1.79991418776028 37.9429567045855\\
1.84833135846112 56.4924941848908\\
1.89882983065378 107.241735116193\\
1.95070235650727 255.184198076309\\
};
\addlegendentry{$\text{a}_\text{1}$};
\addplot [
color=blue,
solid,
line width=1.5pt
]
table[row sep=crcr]{
0 0.304546535015106\\
0.0999666868591286 1.7608035504818\\
0.14994847246798 5.22279033064842\\
0.199985722669264 6.9700922369957\\
0.249949841413249 7.28277409076691\\
0.299947957010717 7.01095330715179\\
0.349953821967313 6.89152657985687\\
0.399976532272618 7.30086064338684\\
0.450097750416451 8.2534236907959\\
0.500022610367541 9.50975930690765\\
0.550018334435385 10.7519751787186\\
0.599967687953469 11.6963572502136\\
0.649996580770619 12.1910936832428\\
0.700015403928287 12.2382789850235\\
0.750007258685311 11.9800099134445\\
0.799945925236683 11.6412487030029\\
0.84995311550608 11.457008600235\\
0.899993657317734 11.6067721843719\\
0.949912640834382 12.1602535247803\\
0.999972604873861 13.0632727146149\\
1.0499570770376 14.140837430954\\
1.09994829057387 15.1534025669098\\
1.14987942654735 15.8583917617798\\
1.19988794346681 16.0904226303101\\
1.24995188468364 15.8203406333923\\
1.29979652659269 15.1997027397156\\
1.34983425117069 14.536256313324\\
1.39974893534602 14.2435127496719\\
1.44981366582721 14.7097660303116\\
1.49989148955403 16.153014421463\\
1.54995414154466 18.4720323085785\\
1.59991842813564 21.1917930841446\\
1.6499318468167 23.6313501596451\\
1.69991355787277 25.3865704536438\\
1.74983108268398 27.4215255975723\\
1.79991418776028 34.0121833086014\\
1.84833135846112 54.7073881626129\\
1.89882983065378 112.721429526806\\
1.95070235650727 253.296808421612\\
};
\addlegendentry{Funktion};
\end{axis}
\end{tikzpicture}%
\caption{Testplot} % caption
\end{figure}
\end{document}
Grüße
Epllus
PS. \usepgfplotslibrary{external} oder \usetikzlibrary{pgfplots.external}
EDIT: Du hast \usepackage{amsmath} vergessen (wegen \text{}).
1. Kannst du nicht einfach „standalone“ nehmen?
[code]\documentclass{standalone}
\usepackage{pgfplots}
\usepackage{amsmath}
\begin{document}
\begin{tikzpicture}
\begin{axis}[%
%width=\figurewidth,
%height=\figureheight,
scale only axis,
xmin=0,
xmax=2,
xlabel={magnetische Polarisation J (T)},
xmajorgrids,
ymin=0,
ymax=300,
ylabel={magnetische Feldstaerke H (A/m)},
ymajorgrids,
axis x line*=bottom,
axis y line*=left,
legend style={at={(0.290773809523807,0.747222222222222)},anchor=south west,draw=black,fill=white,legend cell align=left}
]
\addplot [
color=blue,
line width=1.5pt,
mark size=3.0pt,
only marks,
mark=x,
mark options={solid,draw=black}
]
table[row sep=crcr]{
0 0\\
0.0999666868591286 3.48640381318019\\
0.14994847246798 4.61545758657749\\
0.199985722669264 5.48153882560792\\
0.249949841413249 6.39065204517804\\
0.299947957010717 7.14801695446672\\
0.349953821967313 7.91036483703354\\
0.399976532272618 8.52659737026922\\
0.450097750416451 9.13621890136789\\
0.500022610367541 9.63197734173655\\
0.550018334435385 10.1329498121077\\
0.599967687953469 10.5707509577677\\
0.649996580770619 11.0279947217953\\
0.700015403928287 11.4202879317111\\
0.750007258685311 11.7990433971682\\
0.799945925236683 12.1930506739032\\
0.84995311550608 12.542250611286\\
0.899993657317734 12.8844553590562\\
0.949912640834382 13.2022877693952\\
0.999972604873861 13.5401286764703\\
1.0499570770376 13.8607421694059\\
1.09994829057387 14.1599136461373\\
1.14987942654735 14.4427675385012\\
1.19988794346681 14.7716403260394\\
1.24995188468364 14.8985475702352\\
1.29979652659269 15.226500203805\\
1.34983425117069 15.5640310456756\\
1.39974893534602 16.019359315911\\
1.44981366582721 16.522502237118\\
1.49989148955403 17.136983978165\\
1.54995414154466 17.9822738052251\\
1.59991842813564 19.2009912215814\\
1.6499318468167 21.1007535625428\\
1.69991355787277 23.9284939454521\\
1.74983108268398 28.7222470840893\\
1.79991418776028 37.9429567045855\\
1.84833135846112 56.4924941848908\\
1.89882983065378 107.241735116193\\
1.95070235650727 255.184198076309\\
};
\addlegendentry{$\text{a}_\text{1}$};
\addplot [
color=blue,
solid,
line width=1.5pt
]
table[row sep=crcr]{
0 0.304546535015106\\
0.0999666868591286 1.7608035504818\\
0.14994847246798 5.22279033064842\\
0.199985722669264 6.9700922369957\\
0.249949841413249 7.28277409076691\\
0.299947957010717 7.01095330715179\\
0.349953821967313 6.89152657985687\\
0.399976532272618 7.30086064338684\\
0.450097750416451 8.2534236907959\\
0.500022610367541 9.50975930690765\\
0.550018334435385 10.7519751787186\\
0.599967687953469 11.6963572502136\\
0.649996580770619 12.1910936832428\\
0.700015403928287 12.2382789850235\\
0.750007258685311 11.9800099134445\\
0.799945925236683 11.6412487030029\\
0.84995311550608 11.457008600235\\
0.899993657317734 11.6067721843719\\
0.949912640834382 12.1602535247803\\
0.999972604873861 13.0632727146149\\
1.0499570770376 14.140837430954\\
1.09994829057387 15.1534025669098\\
1.14987942654735 15.8583917617798\\
1.19988794346681 16.0904226303101\\
1.24995188468364 15.8203406333923\\
1.29979652659269 15.1997027397156\\
1.34983425117069 14.536256313324\\
1.39974893534602 14.2435127496719\\
1.44981366582721 14.7097660303116\\
1.49989148955403 16.153014421463\\
1.54995414154466 18.4720323085785\\
1.59991842813564 21.1917930841446\\
1.6499318468167 23.6313501596451\\
1.69991355787277 25.3865704536438\\
1.74983108268398 27.4215255975723\\
1.79991418776028 34.0121833086014\\
1.84833135846112 54.7073881626129\\
1.89882983065378 112.721429526806\\
1.95070235650727 253.296808421612\\
};
\addlegendentry{Funktion};
\end{axis}
\end{tikzpicture}%
\end{document}
[/code]
2. Musst du ein prefix verwenden? Ohne geht es.
[code]\documentclass{article}
\usepackage{pgfplots}
\usepackage{amsmath}
\usepgfplotslibrary{external}
\tikzexternalize
\begin{document}
\begin{figure}
\centering
\newlength\figureheight % define length \figureheight
\newlength\figurewidth % define length \figurewidth
\setlength\figureheight{6cm} % set \figureheight
\setlength\figurewidth{6cm} % set \figurewidth
\tikzsetnextfilename{test} % name next TikZ figure
\begin{tikzpicture}
\begin{axis}[%
width=\figurewidth,
height=\figureheight,
scale only axis,
xmin=0,
xmax=2,
xlabel={magnetische Polarisation J (T)},
xmajorgrids,
ymin=0,
ymax=300,
ylabel={magnetische Feldstaerke H (A/m)},
ymajorgrids,
axis x line*=bottom,
axis y line*=left,
legend style={at={(0.290773809523807,0.747222222222222)},anchor=south west,draw=black,fill=white,legend cell align=left}
]
\addplot [
color=blue,
line width=1.5pt,
mark size=3.0pt,
only marks,
mark=x,
mark options={solid,draw=black}
]
table[row sep=crcr]{
0 0\\
0.0999666868591286 3.48640381318019\\
0.14994847246798 4.61545758657749\\
0.199985722669264 5.48153882560792\\
0.249949841413249 6.39065204517804\\
0.299947957010717 7.14801695446672\\
0.349953821967313 7.91036483703354\\
0.399976532272618 8.52659737026922\\
0.450097750416451 9.13621890136789\\
0.500022610367541 9.63197734173655\\
0.550018334435385 10.1329498121077\\
0.599967687953469 10.5707509577677\\
0.649996580770619 11.0279947217953\\
0.700015403928287 11.4202879317111\\
0.750007258685311 11.7990433971682\\
0.799945925236683 12.1930506739032\\
0.84995311550608 12.542250611286\\
0.899993657317734 12.8844553590562\\
0.949912640834382 13.2022877693952\\
0.999972604873861 13.5401286764703\\
1.0499570770376 13.8607421694059\\
1.09994829057387 14.1599136461373\\
1.14987942654735 14.4427675385012\\
1.19988794346681 14.7716403260394\\
1.24995188468364 14.8985475702352\\
1.29979652659269 15.226500203805\\
1.34983425117069 15.5640310456756\\
1.39974893534602 16.019359315911\\
1.44981366582721 16.522502237118\\
1.49989148955403 17.136983978165\\
1.54995414154466 17.9822738052251\\
1.59991842813564 19.2009912215814\\
1.6499318468167 21.1007535625428\\
1.69991355787277 23.9284939454521\\
1.74983108268398 28.7222470840893\\
1.79991418776028 37.9429567045855\\
1.84833135846112 56.4924941848908\\
1.89882983065378 107.241735116193\\
1.95070235650727 255.184198076309\\
};
\addlegendentry{$\text{a}_\text{1}$};
\addplot [
color=blue,
solid,
line width=1.5pt
]
table[row sep=crcr]{
0 0.304546535015106\\
0.0999666868591286 1.7608035504818\\
0.14994847246798 5.22279033064842\\
0.199985722669264 6.9700922369957\\
0.249949841413249 7.28277409076691\\
0.299947957010717 7.01095330715179\\
0.349953821967313 6.89152657985687\\
0.399976532272618 7.30086064338684\\
0.450097750416451 8.2534236907959\\
0.500022610367541 9.50975930690765\\
0.550018334435385 10.7519751787186\\
0.599967687953469 11.6963572502136\\
0.649996580770619 12.1910936832428\\
0.700015403928287 12.2382789850235\\
0.750007258685311 11.9800099134445\\
0.799945925236683 11.6412487030029\\
0.84995311550608 11.457008600235\\
0.899993657317734 11.6067721843719\\
0.949912640834382 12.1602535247803\\
0.999972604873861 13.0632727146149\\
1.0499570770376 14.140837430954\\
1.09994829057387 15.1534025669098\\
1.14987942654735 15.8583917617798\\
1.19988794346681 16.0904226303101\\
1.24995188468364 15.8203406333923\\
1.29979652659269 15.1997027397156\\
1.34983425117069 14.536256313324\\
1.39974893534602 14.2435127496719\\
1.44981366582721 14.7097660303116\\
1.49989148955403 16.153014421463\\
1.54995414154466 18.4720323085785\\
1.59991842813564 21.1917930841446\\
1.6499318468167 23.6313501596451\\
1.69991355787277 25.3865704536438\\
1.74983108268398 27.4215255975723\\
1.79991418776028 34.0121833086014\\
1.84833135846112 54.7073881626129\\
1.89882983065378 112.721429526806\\
1.95070235650727 253.296808421612\\
};
\addlegendentry{Funktion};
\end{axis}
\end{tikzpicture}%
\caption{Testplot} % caption
\end{figure}
\end{document}
[/code]
Grüße
Epllus
PS. \usepgfplotslibrary{external} oder \usetikzlibrary{pgfplots.external}