1

The following example:

\begin{tikzpicture}
\begin{axis}[ybar,ymin=-5,ymax=0]
\addplot coordinates{
(1,-1)
(2,-2)
(3,-3)
};
\end{axis}
\end{tikzpicture}

compiles to this bar chart:

1

I'd like the bars to start from the bottom of the screen instead of the top. Are there any possibilities to set the origin point to the bottom?

Thanks for your help ;)

Edit: Like this. The Plot starts from the bottom(most negative value) and move to the nagative value. This example works with a log scale. how can i do this with my linear scale?

\begin{tikzpicture}
\begin{axis}[ybar, ymode = log, log origin=infty]
\addplot coordinates{
(1,1e-1)
(2,1e-2)
(3,1e-3)
};
\end{axis}
\end{tikzpicture}

enter image description here

  • But the values are negative anyway, how would you make the bars go "up"? – zyy Apr 25 at 20:56
  • The Plot should start from the bottom(most negative value) and move to the nagative value. I found an example with a log scale. But how can i do this with a linear scale? – user187571 Apr 26 at 7:43
2

Like this?

\documentclass[margin=3mm]{standalone}

\usepackage{tikz-cd,pgfplots}
 \pgfplotsset{compat=1.16}
\begin{document}

\begin{tikzpicture}[rotate=180]
\begin{axis}[ybar,ymin=-5,ymax=0,
tick label style={rotate=180},
x dir=reverse,
y dir=reverse,
ylabel near ticks, yticklabel pos=right,
symbolic y coords={-5,-4,-3,-2,-1,0},
axis x line*=top,
axis y line*=right
]
\addplot coordinates{
(1,-1)
(2,-2)
(3,-3)
};
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

  • Unfortunately, no. Your example ist just mirrowed. I need a bar diamgram with starts from the bottom(most negative value) and moves to the nagative value like in my log example but for a linear scale. – user187571 Apr 26 at 7:46
  • @TobiasDomhoefer, If I understand correctly you, I edited my answer. – ferahfeza Apr 26 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy