1

Here is the bar graph I'm trying to copy (not numbers just the graph),

And here's my attempt,

And here is the code,


\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}

\pgfplotsset{compat=1.18}


\begin{document}

\begin{center}
\begin{tikzpicture}
\begin{axis}[
    x tick label style={/pgf/number format/1000 sep=},
    ylabel=$\Omega_{total}$,
        xlabel=$q_A$,
        ybar interval=0.7]
\addplot 
    coordinates {(0,330) (1,210) (2,126) (3,70) (4,35) (5,15) (6,5) (7,1)};
\end{axis}
\end{tikzpicture}
\end{center}

\end{document}

You can see that the 7th bar is not showing and the x-axis is lower than it should be. How can I change it to look like the reference graph? with the color as well. Thank you in advance.

1

1 Answer 1

1

You can tweak the axis options to your liking. Here is a starting point:

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}

\pgfplotsset{compat=1.18}

\begin{document}

    \begin{center}
        \begin{tikzpicture}
            \begin{axis}[
                x tick label style={/pgf/number format/1000 sep=},
                xlabel=$q_A$,
                axis x line*=bottom,
                ylabel=$\Omega_{total}$,
                ybar interval=0.7,
                ymin=0,
                ymax=400,
                ytick align=outside,
                axis y line*=left,
            ]
                \addplot[fill=gray!40]
                    coordinates {(0,330) (1,210) (2,126) (3,70) (4,35) (5,15) (6,5) (7,1)};
            \end{axis}
        \end{tikzpicture}
    \end{center}

\end{document}

enter image description here

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .