Seite 1 von 1

Tikz Barchart Achsenbeschriftung

Verfasst: Mi 4. Jan 2023, 14:09
von 123214jasmin
Liebes Forum,

Ich habe folgende Grafik erstellt und weiß leider nicht, wie diese Striche heißen, die sich zwischen Achsenbeschriftung und Balken auf beiden Seiten befinden.
Außerdem ist oben ein Teil des Diagramms abgeschnitten.
Weiß jemand, woran das liegt?
\begin{figure}
\begin{tikzpicture}
\pgfplotsset{%
    width=0.5\textwidth,
    height=0.6\textwidth
}
	\begin{axis}[
	bar width=5pt,
    xbar,
    width=0.6\textwidth,
    y axis line style = { opacity = 0 },
    axis x line       = none,
    ytick distance= 1,
    enlarge y limits =0.005,
        y tick label style={xshift=.2em},
    xmin = 0, 
    symbolic y coords = { Cross-Experiment Analysis,Interaction Detection, Ship Recommendation, Alerting, Drill-Down Capability, Auto-Shutdown,Near-Real Time Alerting, Scorecard Generation, Power Analysis, Isolation, Iteration,A/A-Testing, Targeting, Rollout, Configuration, Randomization},
    nodes near coords
  ]
  \addplot coordinates { (0,Cross-Experiment Analysis) (0,Interaction Detection) (0,Ship Recommendation) (0,Alerting)(1,Drill-Down Capability)(1,Auto-Shutdown)(1,Near-Real Time Alerting)(7,Power Analysis)(9,A/A-Testing)(9,Iteration)(8,Isolation)(21,Configuration) (23,Randomization) (17,Rollout) (12,Targeting) (2,Scorecard Generation)};
 	\end{axis}
\end{tikzpicture}
\caption{Umfrageergebnisse: Feature der Experimentierplattform}
\end{figure}

Bild

Re: Tikz Barchart Achsenbeschriftung

Verfasst: Mi 4. Jan 2023, 16:28
von Bartman
\documentclass{standalone}
\usepackage{pgfplots}

\pgfplotsset{compat=1.18}% https://texwelt.de/fragen/19163

\begin{document}
\begin{tikzpicture}
  \begin{axis}[
    width=0.6\textwidth,
    height=0.7\textwidth,
    xbar,
    bar width=5pt,
    ytick=data,% hinzugefügt
    tickwidth=0pt,% ändert die Länge der Striche
    y axis line style={draw=none},
    axis x line=none,
    % Wähle einen größeren Wert, damit auch die Balken im Randbereich vollständig ausgegeben werden.
    enlarge y limits=0.03,
    xmin=0, 
    symbolic y coords={
      Cross-Experiment Analysis,
      Interaction Detection, 
      Ship Recommendation, 
      Alerting, 
      Drill-Down Capability, 
      Auto-Shutdown,
      Near-Real Time Alerting, 
      Scorecard Generation, 
      Power Analysis, 
      Isolation, 
      Iteration,
      A/A-Testing, 
      Targeting, 
      Rollout, 
      Configuration, 
      Randomization
    },
    nodes near coords
  ]
  \addplot coordinates { 
    (0,Cross-Experiment Analysis) 
    (0,Interaction Detection) 
    (0,Ship Recommendation) 
    (0,Alerting)
    (1,Drill-Down Capability)
    (1,Auto-Shutdown)
    (1,Near-Real Time Alerting)
    (7,Power Analysis)
    (9,A/A-Testing)
    (9,Iteration)
    (8,Isolation)
    (21,Configuration)
    (23,Randomization) 
    (17,Rollout) 
    (12,Targeting)
    (2,Scorecard Generation)
  };
  \end{axis}
\end{tikzpicture}
\end{document}