von IrenaSekuta » Do 11. Apr 2013, 13:22
------------------------------
UPDATE:
Da bisher keine Lösung erfolgte, habe ich das Thema auch hier gepostet:
http://tex.stackexchange.com/questions/ ... regression
Lösung ist unter o.g. Link zu finden.
------------------------------
Hallo zusammen,
anbei mein Minimalbeispiel:
\documentclass{standalone}
\usepackage{pgfplots, pgfplotstable}
\begin{document}
\pgfplotstableread{
Year ICumCDP
2008 3.73E-07
2009 3.35E-07
2010 2.01E-07
2011 3.88E-07
2012 1.36E-06
}\datatable
\pgfplotstablecreatecol[linear regression={ymode=log}]{regression}{\datatable}
\xdef\slope{\pgfplotstableregressiona} % save the slope parameter
\xdef\intercept{\pgfplotstableregressionb} % save the intercept parameter
\begin{tikzpicture}
\begin{semilogyaxis}[
/pgf/number format/.cd,
use comma,
1000 sep={},
log basis y = 10,
ylabel = {ICumCDP},
ymin = 1E-8,
ymax = 1E-4,
xlabel = {Year},
xtick = {2008,2009,2010,2011,2012}
]
\addplot [only marks, blue, x=Year, y=ICumCDP] table {\datatable};
\addplot [no markers, red, domain=2008:2012] {exp(\intercept+\slope*x)};
\end{semilogyaxis}
\end{tikzpicture}
\end{document}
Die Basis für meinen Code habe ich
http://tex.stackexchange.com/questions/ ... ng-semilog entnommen, wo die Regressionsgrade auch richtig dargestellt wird.
Bei mir hingegen ist die Grade falsch dargestellt.
Gruss,
Irena
[color=red]
------------------------------
UPDATE:
Da bisher keine Lösung erfolgte, habe ich das Thema auch hier gepostet:
http://tex.stackexchange.com/questions/108309/pgfplots-and-linear-regression
Lösung ist unter o.g. Link zu finden.
------------------------------
[/color]
Hallo zusammen,
anbei mein Minimalbeispiel:
[code]\documentclass{standalone}
\usepackage{pgfplots, pgfplotstable}
\begin{document}
\pgfplotstableread{
Year ICumCDP
2008 3.73E-07
2009 3.35E-07
2010 2.01E-07
2011 3.88E-07
2012 1.36E-06
}\datatable
\pgfplotstablecreatecol[linear regression={ymode=log}]{regression}{\datatable}
\xdef\slope{\pgfplotstableregressiona} % save the slope parameter
\xdef\intercept{\pgfplotstableregressionb} % save the intercept parameter
\begin{tikzpicture}
\begin{semilogyaxis}[
/pgf/number format/.cd,
use comma,
1000 sep={},
log basis y = 10,
ylabel = {ICumCDP},
ymin = 1E-8,
ymax = 1E-4,
xlabel = {Year},
xtick = {2008,2009,2010,2011,2012}
]
\addplot [only marks, blue, x=Year, y=ICumCDP] table {\datatable};
\addplot [no markers, red, domain=2008:2012] {exp(\intercept+\slope*x)};
\end{semilogyaxis}
\end{tikzpicture}
\end{document}[/code]
Die Basis für meinen Code habe ich [url]http://tex.stackexchange.com/questions/69123/how-to-expand-linear-regression-fit-to-the-full-x-axis-range-while-using-semilog[/url] entnommen, wo die Regressionsgrade auch richtig dargestellt wird.
Bei mir hingegen ist die Grade falsch dargestellt.
Gruss,
Irena