Ich habe folgende beiden "Probleme". 1) Die "minor y ticks" werden nicht angezeigt. 2) Ich möchte gerne die dickeren, farbigen Balken so positionieren, dass diese unterhalb der schwarzen Linie sind, jedoch gleichmässig übereinander verteilt. Momentan positioniere ich diese vertikal mit der y-Koordinate. Da die Skala aber logaritmisch ist, überlappen diese sich leider. Dies bedeutet, dass ich die Balken bzgl. des Anfangs und des Endes mit der x-Koordinate (Datum) bestimmen will, die vertikale Positioierung irgendwie "relativ" zum y-min Wert sein soll. Gäbe es noch eine andere Art der vertikalen Positionierung als die über y-Koordinaten? Open in Online-Editor
\documentclass[tikz=true]{standalone} \usepackage{fontspec} \usepackage{pgfplots} \usepgfplotslibrary{dateplot} \usetikzlibrary{shapes,arrows, patterns} \pgfplotsset{compat=newest} \begin{document} \newcommand\BoxWidth{5pt} \begin{tikzpicture} \newcommand\PosNode{0.02} \begin{semilogyaxis}[ % ----- Allgemein ----- width = \textwidth, height = 5cm, enlargelimits =false, date coordinates in = x, date ZERO = {2015-08-01 00:00}, every axis plot/.append style={const plot, mark=\empty}, % %----- x Achse ----- xmin = 2015-08-09 00:00, xmax = 2015-09-13 00:00, try min ticks=30, major x tick style={black}, minor x tick num=3, minor x tick style={draw=none}, xmajorgrids, xminorgrids, xticklabel style = {anchor=east, rotate=90, font=\tiny}, % %----- y-Achse ----- ymin=1E-8, ymax=1E-4, ylabel = {CFDF}, major y tick style={black}, minor y tick style={black}, ] \addplot[black, line width=1.5pt] coordinates { (2015-08-09 08:00, 1.00E-6) % POS 0 (2015-08-10 15:00, 1.50E-6) % POS 2-3 (2015-08-11 03:00, 2.00E-6) % POS 4-5 (2015-08-11 06:00, 2.50E-6) % POS 6 (2015-08-11 18:00, 3.00E-6) % POS 7-9 (2015-08-13 03:00, 3.50E-6) % POS 10 (2015-09-05 12:00, 4.00E-6) % POS 11-12 (2015-09-07 04:00, 4.50E-6) % POS 13 (2015-09-10 09:00, 5.00E-6) % POS 14-16 (2015-09-10 15:00, 5.50E-6) % POS 17-18 (2015-09-11 00:00, 6.00E-6) % POS 19-20 (2015-09-13 00:00, 1.00E-6) % POS 19-20 }; % CRD \addplot[red, line width=\BoxWidth] coordinates { (2015-08-11 06:00, 1E-7) (2015-09-01 05:00, 1E-7) } node[pos=\PosNode, left] {\tiny CRD}; % SEHR \addplot[blue, line width=\BoxWidth] coordinates { (2015-08-12 00:00, 2E-7) (2015-09-02 12:00, 2E-7) } node[pos=\PosNode, left] {\tiny SEHR}; % Div. 21 \addplot[green, line width=\BoxWidth] coordinates { (2015-08-13 03:00, 3E-7) (2015-08-23 07:00, 3E-7) } node[pos=\PosNode, left] {\tiny Div.21}; % Div. 11 \addplot[orange, line width=\BoxWidth] coordinates { (2015-08-23 07:00, 4E-7) (2015-09-04 22:00, 4E-7) } node[pos=\PosNode, left] {\tiny Div.11}; \end{semilogyaxis} \end{tikzpicture} \end{document} gefragt 21 Apr '15, 10:45 dzaic |
Aus der Dokumentation von
Das heißt, die Angabe der Option Wenn die vertikalen Abstände zwischen den Balken bei einer logarithmischen Achse gleich sein müssen, dann muss der Quotient der y-Koordinaten von zwei aufeinanderfolgenden Balken gleich sein. Bei linearen Achsen wäre es dagegen die Differenz. Im MWE könnte man zum Beispiel den Faktor Open in Online-Editor
\documentclass[tikz=true,margin=5pt]{standalone} \usepackage{luatextra} \setmainfont{Arial} \setsansfont{Arial} \setmonofont{Consolas} \defaultfontfeatures{Ligatures=TeX} \usepackage{pgfplots} \usepgfplotslibrary{dateplot} \usetikzlibrary{shapes,arrows, patterns} \pgfplotsset{compat=1.12} \begin{document} \newcommand\BoxWidth{5pt} \begin{tikzpicture}[ boxlabel/.style={pos=.02,left,font=\tiny} ] \begin{semilogyaxis}[ % ----- Allgemein ----- width = \textwidth, height = 5cm, enlargelimits =false, date coordinates in = x, date ZERO = {2015-08-01 00:00}, every axis plot/.append style={const plot, mark=\empty,line width=\BoxWidth}, % %----- x Achse ----- xmin = 2015-08-09 00:00, xmax = 2015-09-13 00:00, try min ticks=30, major x tick style={black}, minor x tick num=3, minor x tick style={draw=none}, xmajorgrids, xminorgrids, xticklabel style = {anchor=east, rotate=90, font=\tiny}, % %----- y-Achse ----- ymin=1E-8, ymax=1E-4, ylabel = {CFDF}, major y tick style={black}, minor y tick style={black}, ytick={1E-5,1E-6}, minor ytick={8E-7,2E-6,4E-6,6E-6,8E-6,2E-5,4E-5,6E-5,8E-5}, ] \addplot[black, line width=1.5pt] coordinates { (2015-08-09 08:00, 1.00E-6) % POS 0 (2015-08-10 15:00, 1.50E-6) % POS 2-3 (2015-08-11 03:00, 2.00E-6) % POS 4-5 (2015-08-11 06:00, 2.50E-6) % POS 6 (2015-08-11 18:00, 3.00E-6) % POS 7-9 (2015-08-13 03:00, 3.50E-6) % POS 10 (2015-09-05 12:00, 4.00E-6) % POS 11-12 (2015-09-07 04:00, 4.50E-6) % POS 13 (2015-09-10 09:00, 5.00E-6) % POS 14-16 (2015-09-10 15:00, 5.50E-6) % POS 17-18 (2015-09-11 00:00, 6.00E-6) % POS 19-20 (2015-09-13 00:00, 1.00E-6) % POS 19-20 }; % CRD \addplot[red] coordinates { (2015-08-11 06:00, .5E-7) (2015-09-01 05:00, .5E-7) } node[boxlabel] {CRD}; % SEHR \addplot[blue] coordinates { (2015-08-12 00:00, 1E-7) (2015-09-02 12:00, 1E-7) } node[boxlabel] {SEHR}; % Div. 21 \addplot[green] coordinates { (2015-08-13 03:00, 2E-7) (2015-08-23 07:00, 2E-7) } node[boxlabel] {Div.21}; % Div. 11 \addplot[orange] coordinates { (2015-08-23 07:00, 4E-7) (2015-09-04 22:00, 4E-7) } node[boxlabel] {Div.11}; \end{semilogyaxis} \end{tikzpicture} \end{document} beantwortet 21 Apr '15, 13:57 esdd |
Alternativ zu meiner anderen Antwort kannst Du auch die Option Open in Online-Editor
\documentclass[tikz=true,margin=5pt]{standalone} \usepackage{luatextra} \setmainfont{Arial} \setsansfont{Arial} \setmonofont{Consolas} \defaultfontfeatures{Ligatures=TeX} \usepackage{pgfplots} \usepgfplotslibrary{dateplot} \usetikzlibrary{shapes,arrows, patterns} \pgfplotsset{compat=1.12} \begin{document} \newcommand\BoxWidth{5pt} \newcommand\BoxSep{3pt}% Abstand zwischen Balken \begin{tikzpicture}[ boxlabel/.style={pos=.02,left,font=\tiny}, boxshift/.style={yshift=#1*(\BoxWidth+\BoxSep)} ] \newcommand\StartBox{4E-8} \begin{semilogyaxis}[ % ----- Allgemein ----- width = \textwidth, height = 5cm, enlargelimits =false, date coordinates in = x, date ZERO = {2015-08-01 00:00}, every axis plot/.append style={const plot, mark=\empty,line width=\BoxWidth}, % %----- x Achse ----- xmin = 2015-08-09 00:00, xmax = 2015-09-13 00:00, try min ticks=30, major x tick style={black}, minor x tick num=3, minor x tick style={draw=none}, xmajorgrids, xminorgrids, xticklabel style = {anchor=east, rotate=90, font=\tiny}, % %----- y-Achse ----- ymin=1E-8, ymax=1E-4, ylabel = {CFDF}, major y tick style={black}, minor y tick style={black}, ytick={1E-5,1E-6}, minor ytick={8E-7,2E-6,4E-6,6E-6,8E-6,2E-5,4E-5,6E-5,8E-5}, ] \addplot[black, line width=1.5pt] coordinates { (2015-08-09 08:00, 1.00E-6) % POS 0 (2015-08-10 15:00, 1.50E-6) % POS 2-3 (2015-08-11 03:00, 2.00E-6) % POS 4-5 (2015-08-11 06:00, 2.50E-6) % POS 6 (2015-08-11 18:00, 3.00E-6) % POS 7-9 (2015-08-13 03:00, 3.50E-6) % POS 10 (2015-09-05 12:00, 4.00E-6) % POS 11-12 (2015-09-07 04:00, 4.50E-6) % POS 13 (2015-09-10 09:00, 5.00E-6) % POS 14-16 (2015-09-10 15:00, 5.50E-6) % POS 17-18 (2015-09-11 00:00, 6.00E-6) % POS 19-20 (2015-09-13 00:00, 1.00E-6) % POS 19-20 }; % CRD \addplot[red] coordinates { (2015-08-11 06:00,\StartBox) (2015-09-01 05:00,\StartBox) } node[boxlabel] {CRD}; % SEHR \addplot[blue,boxshift=1] coordinates { (2015-08-12 00:00,\StartBox) (2015-09-02 12:00,\StartBox) } node[boxlabel] {SEHR}; % Div. 21 \addplot[green,boxshift=2] plot coordinates { (2015-08-13 03:00,\StartBox) (2015-08-23 07:00,\StartBox) } node[boxlabel] {Div.21}; % Div. 11 \addplot[orange,boxshift=3] coordinates { (2015-08-23 07:00,\StartBox) (2015-09-04 22:00,\StartBox) } node[boxlabel] {Div.11}; \end{semilogyaxis} \end{tikzpicture} \end{document} Man kann dafür auch eine Open in Online-Editor
\documentclass[tikz=true,margin=5pt]{standalone} \usepackage{luatextra} \setmainfont{Arial} \setsansfont{Arial} \setmonofont{Consolas} \defaultfontfeatures{Ligatures=TeX} \usepackage{pgfplots} \usepgfplotslibrary{dateplot} \usetikzlibrary{shapes,arrows, patterns} \pgfplotsset{compat=1.12} \begin{document} \newcommand\BoxWidth{5pt} \newcommand\BoxSep{3pt} \begin{tikzpicture}[ boxlabel/.style={pos=.02,left,font=\tiny}, boxshift/.style={yshift=#1*(\BoxWidth+\BoxSep)} ] \newcommand\StartBox{.4E-7} \begin{semilogyaxis}[ % ----- Allgemein ----- width = \textwidth, height = 5cm, enlargelimits =false, date coordinates in = x, date ZERO = {2015-08-01 00:00}, every axis plot/.append style={const plot,line width=\BoxWidth}, % %----- x Achse ----- xmin = 2015-08-09 00:00, xmax = 2015-09-13 00:00, try min ticks=30, major x tick style={black}, minor x tick num=3, minor x tick style={draw=none}, xmajorgrids, xminorgrids, xticklabel style = {anchor=east, rotate=90, font=\tiny}, % %----- y-Achse ----- ymin=1E-8, ymax=1E-4, ylabel = {CFDF}, major y tick style={black}, minor y tick style={black}, ytick={1E-5,1E-6}, minor ytick={8E-7,2E-6,4E-6,6E-6,8E-6,2E-5,4E-5,6E-5,8E-5}, % %----- cycle list ----- cycle list={% black,line width=1.5pt\\% red\\% blue,boxshift=1\\% green,boxshift=2\\% orange,boxshift=3\\% } ] \addplot coordinates { (2015-08-09 08:00, 1.00E-6) % POS 0 (2015-08-10 15:00, 1.50E-6) % POS 2-3 (2015-08-11 03:00, 2.00E-6) % POS 4-5 (2015-08-11 06:00, 2.50E-6) % POS 6 (2015-08-11 18:00, 3.00E-6) % POS 7-9 (2015-08-13 03:00, 3.50E-6) % POS 10 (2015-09-05 12:00, 4.00E-6) % POS 11-12 (2015-09-07 04:00, 4.50E-6) % POS 13 (2015-09-10 09:00, 5.00E-6) % POS 14-16 (2015-09-10 15:00, 5.50E-6) % POS 17-18 (2015-09-11 00:00, 6.00E-6) % POS 19-20 (2015-09-13 00:00, 1.00E-6) % POS 19-20 }; % CRD \addplot coordinates { (2015-08-11 06:00,\StartBox) (2015-09-01 05:00,\StartBox) } node[boxlabel] {CRD}; % SEHR \addplot coordinates { (2015-08-12 00:00,\StartBox) (2015-09-02 12:00,\StartBox) } node[boxlabel] {SEHR}; % Div. 21 \addplot coordinates { (2015-08-13 03:00,\StartBox) (2015-08-23 07:00,\StartBox) } node[boxlabel] {Div.21}; % Div. 11 \addplot coordinates { (2015-08-23 07:00,\StartBox) (2015-09-04 22:00,\StartBox) } node[boxlabel] {Div.11}; \end{semilogyaxis} \end{tikzpicture} \end{document} Das Ergebnis ist das gleiche wie oben. beantwortet 21 Apr '15, 17:14 esdd |