von Alexander » Fr 22. Jan 2016, 13:53
Guten Tag,
ich möchte ein Balkendiagram mit den min-/max- Werten erstellen. Wie z.B. dieses hier:
klick
Ich finde keine Lösung, wie man zwischen zwei y-koordinaten aus der Tabelle (value1 und value2) die Linie zeichnet.
\documentclass[paper=a3,12pt,version=last,landscape]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{pgfplots}
\usepgfplotslibrary{dateplot}
\usepackage{geometry}
\geometry{left=1cm,right=1cm,top=2.3cm, bottom=1.3cm, bindingoffset=5mm}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
grid=major,
width=0.9\textwidth,height=0.9\textheight,
title={xxx},
ylabel={\% relative Feuchtigkeit},
date coordinates in=x,
xticklabel={\day.\month.\year},
x tick label style={yshift=-3pt,xshift=-4pt,rotate=-90,anchor=west, font=\small},
extra y ticks={22.7375, 61.4002},
extra y tick labels={{22.7375 \%},{61.4002 \%}},
extra y tick style={grid=major, tick label style={xshift=-1cm}},
%x tick label style={align=center},
date ZERO=2014-01-01, % Set near lowest date
xmin={2014-11-18}, % A date with no time is assumed to have a time of 00:00
xmax={2015-11-17}
]
\addplot[color = red, mark = *] table [col sep=comma,trim cells=true,y=value2] {log.txt};
\addplot[color = blue, mark = *] table [col sep=comma,trim cells=true,y=value1] {log.txt};
\end{axis}
\end{tikzpicture}
\end{document}
Ausschnitt Log.txt:
Date, value1, value2
2015-09-28 00:00, 37.940701, 53.216702
2015-09-29 00:00, 33.932499, 41.861401
2015-09-30 00:00, 31.538300, 44.912800
2015-10-01 00:00, 29.873400, 40.666302
2015-10-02 00:00, 30.007000, 41.048100
2015-10-05 00:00, 46.195599, 50.068401
2015-10-06 00:00, 51.919300, 59.680801
2015-10-07 00:00, 55.654598, 60.191700
2015-10-08 00:00, 42.167198, 59.305099
2015-10-09 00:00, 44.542400, 52.736401
2015-10-12 00:00, 32.629700, 53.524700
2015-10-13 00:00, 34.199799, 43.847000
2015-10-14 00:00, 36.156200, 42.645599
2015-10-15 00:00, 36.279400, 44.408298
2015-10-19 00:00, 38.330101, 47.482700
2015-10-20 00:00, 39.765701, 45.308800
2015-10-21 00:00, 39.665298, 46.922600
2015-10-22 00:00, 37.822201, 45.925098
2015-10-23 00:00, 39.664101, 48.715599
2015-10-26 00:00, 43.057999, 49.921299
2015-10-27 00:00, 36.232700, 45.382599
2015-10-28 00:00, 39.736900, 46.449402
2015-10-29 00:00, 38.174599, 45.928799
2015-10-30 00:00, 37.616501, 46.561199
2015-11-02 00:00, 31.866600, 43.014000
2015-11-03 00:00, 30.594299, 38.580002
2015-11-04 00:00, 30.761400, 41.931301
2015-11-05 00:00, 38.021599, 62.745098
2015-11-06 00:00, 47.845299, 59.813400
Guten Tag,
ich möchte ein Balkendiagram mit den min-/max- Werten erstellen. Wie z.B. dieses hier: [url=http://www.lmv-jobboerse.de/_images/editor/Static%20Content/Grafiken/Diagramm1.1.1.GIF]klick[/url]
Ich finde keine Lösung, wie man zwischen zwei y-koordinaten aus der Tabelle (value1 und value2) die Linie zeichnet.
[code]
\documentclass[paper=a3,12pt,version=last,landscape]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{pgfplots}
\usepgfplotslibrary{dateplot}
\usepackage{geometry}
\geometry{left=1cm,right=1cm,top=2.3cm, bottom=1.3cm, bindingoffset=5mm}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
grid=major,
width=0.9\textwidth,height=0.9\textheight,
title={xxx},
ylabel={\% relative Feuchtigkeit},
date coordinates in=x,
xticklabel={\day.\month.\year},
x tick label style={yshift=-3pt,xshift=-4pt,rotate=-90,anchor=west, font=\small},
extra y ticks={22.7375, 61.4002},
extra y tick labels={{22.7375 \%},{61.4002 \%}},
extra y tick style={grid=major, tick label style={xshift=-1cm}},
%x tick label style={align=center},
date ZERO=2014-01-01, % Set near lowest date
xmin={2014-11-18}, % A date with no time is assumed to have a time of 00:00
xmax={2015-11-17}
]
\addplot[color = red, mark = *] table [col sep=comma,trim cells=true,y=value2] {log.txt};
\addplot[color = blue, mark = *] table [col sep=comma,trim cells=true,y=value1] {log.txt};
\end{axis}
\end{tikzpicture}
\end{document}
[/code]
Ausschnitt Log.txt:
[code]
Date, value1, value2
2015-09-28 00:00, 37.940701, 53.216702
2015-09-29 00:00, 33.932499, 41.861401
2015-09-30 00:00, 31.538300, 44.912800
2015-10-01 00:00, 29.873400, 40.666302
2015-10-02 00:00, 30.007000, 41.048100
2015-10-05 00:00, 46.195599, 50.068401
2015-10-06 00:00, 51.919300, 59.680801
2015-10-07 00:00, 55.654598, 60.191700
2015-10-08 00:00, 42.167198, 59.305099
2015-10-09 00:00, 44.542400, 52.736401
2015-10-12 00:00, 32.629700, 53.524700
2015-10-13 00:00, 34.199799, 43.847000
2015-10-14 00:00, 36.156200, 42.645599
2015-10-15 00:00, 36.279400, 44.408298
2015-10-19 00:00, 38.330101, 47.482700
2015-10-20 00:00, 39.765701, 45.308800
2015-10-21 00:00, 39.665298, 46.922600
2015-10-22 00:00, 37.822201, 45.925098
2015-10-23 00:00, 39.664101, 48.715599
2015-10-26 00:00, 43.057999, 49.921299
2015-10-27 00:00, 36.232700, 45.382599
2015-10-28 00:00, 39.736900, 46.449402
2015-10-29 00:00, 38.174599, 45.928799
2015-10-30 00:00, 37.616501, 46.561199
2015-11-02 00:00, 31.866600, 43.014000
2015-11-03 00:00, 30.594299, 38.580002
2015-11-04 00:00, 30.761400, 41.931301
2015-11-05 00:00, 38.021599, 62.745098
2015-11-06 00:00, 47.845299, 59.813400
[/code]