pgfplots Regression

Tabellen und Grafiken erstellen und anordnen


IrenaSekuta
Forum-Century
Forum-Century
Beiträge: 230
Registriert: Di 2. Dez 2008, 10:05

pgfplots Regression

Beitrag von IrenaSekuta »


------------------------------
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
----------------------------------
- WinXP und Win 7 und ansatzweise Ubuntu 9.10 :-)
- Miktex 2.9 (Portable)
- WinEdt 6