Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass{minimal}
- usepackage{pgfplots}
- usepgfplotslibrary{dateplot}
- begin{filecontents}{data.dat}
- date value1
- 2010-01-01 2
- 2010-01-02 10
- 2010-01-03 8
- 2010-01-04 15
- end{filecontents}
- usepackage{pgfplotstable}
- begin{document}
- begin{tikzpicture}
- begin{axis}[
- date coordinates in=x,
- xticklabel={day.month.year},
- xmin={2010-01-01},
- xmax={2010-01-05},x tick label style={yshift=-3pt,xshift=-4pt,rotate=-30,anchor=west}]
- addplot table [x=date,y=value1] {data.dat};
- addplot table [x=date, y={create col/linear regression={y=value1}}] {data.dat};
- end{axis}
- end{tikzpicture}
- end{document}
- documentclass{minimal}
- usepackage{pgfplots}
- usepgfplotslibrary{dateplot}
- begin{filecontents}{data.dat}
- date value1
- 2010-01-01 2
- 2010-01-02 10
- 2010-01-03 8
- 2010-01-04 15
- end{filecontents}
- usepackage{pgfplotstable}
- % formats row ticknum of the input table using '#3'
- % #1: table name
- % #2: column name
- % #3: formatting instruction like day.month.year
- newcommanddatelabelsfromtable[3]{%
- begingroup
- countdefresult=count200 %
- pgfplotstablegetelem{ticknum}{#2}of{#1}%
- pgfcalendardatetojulian{pgfplotsretval}{result}%
- pgfcalendarjuliantodate{result}yearmonthday
- %
- #3%
- endgroup
- }
- begin{document}
- begin{tikzpicture}
- begin{axis}[
- x tick label style={yshift=-3pt,xshift=-4pt,rotate=-30,anchor=west},
- xticklabel={datelabelsfromtable{data.dat}{date}{day.month.year}},
- xtick=data,
- ]
- addplot table [x expr=coordindex,y=value1] {data.dat};
- addplot table [x expr=coordindex, y={create col/linear regression={y=value1}}] {data.dat};
- end{axis}
- end{tikzpicture}
- end{document}
- documentclass{minimal}
- usepackage{pgfplots}
- usepgfplotslibrary{dateplot}
- begin{filecontents}{data.dat}
- date value1
- 2010-01-01 2
- 2010-01-02 10
- 2010-01-03 8
- 2010-01-04 15
- end{filecontents}
- usepackage{pgfplotstable}
- begin{document}
- begin{tikzpicture}
- begin{axis}[
- x tick label style={yshift=-3pt,xshift=-4pt,rotate=-30,anchor=west},
- xticklabels={01.01.2010, 02.01.2010, 03.01.2010, 04.01.2010},
- xtick=data,
- ]
- addplot table [x expr=coordindex,y=value1] {data.dat};
- addplot table [x expr=coordindex, y={create col/linear regression={y=value1}}] {data.dat};
- end{axis}
- end{tikzpicture}
- end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement