0

This question already has an answer here:

\documentclass{article}
\usepackage[a4paper,bindingoffset=0.2in,%
left=1in,right=1in,top=1in,bottom=1in,%
footskip=.25in]{geometry}
\usepackage[magyar]{babel}
\usepackage[utf8]{inputenc}
\usepackage{t1enc}
\usepackage{amsmath}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
x tick label style={
    /pgf/number format/1000 sep=},
ylabel=Eltérés,
enlargelimits=0.2,
ybar interval=0.8,
]
\addplot 
coordinates {(1,25) (2,8.5)
    (3,7.9) (4,3.8) (5,4.2) (6,7.7) (7,6.8) (8,3.2) (9,15.2) };

\end{axis}
\end{tikzpicture}

\end{document}

marked as duplicate by percusse pgfplots Feb 26 '17 at 20:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Add another pair with (10,...). – Ignasi Feb 26 '17 at 19:33
  • very big thank you, you saved my life, I can do my homework :) – Zsombor Feb 26 '17 at 19:35
  • It does work, in the sense that pgfplots does as instructed. Are you actually after ybar, and not ybar interval=0.8? – Torbjørn T. Feb 26 '17 at 19:39
  • You probably wanted an ybar and not an ybar interval. Read differences in pgfplots documentation. – Ignasi Feb 26 '17 at 19:39
  • thank you, everithing is clear, I used ybar interval, because I saw it in an example – Zsombor Feb 26 '17 at 19:42
4

enter image description here

So if you want (9,15.2) to be shown, add another coordinate or change the plot to be ybar(without interval):

\documentclass{article}
\usepackage[a4paper,bindingoffset=0.2in,%
left=1in,right=1in,top=1in,bottom=1in,%
footskip=.25in]{geometry}
\usepackage[magyar]{babel}
\usepackage[utf8]{inputenc}
\usepackage{t1enc}
\usepackage{amsmath}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
x tick label style={
    /pgf/number format/1000 sep=},
ylabel=Eltérés,
enlargelimits=0.2,
ybar,% interval=0.8,
]
\addplot 
coordinates {(1,25) (2,8.5)
    (3,7.9) (4,3.8) (5,4.2) (6,7.7) (7,6.8) (8,3.2) (9,15.2) };

\end{axis}
\end{tikzpicture}

\end{document}

enter image description here

0

Works for me............................

enter image description here

  • I want a 9. on the x axis too, with 15.2 paramter – Zsombor Feb 26 '17 at 19:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.