Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have seen the previous posts regarding "bar chart with text as x axis labels". I tried to use the same code discussed in the posts and in the documentation,

\begin{tikzpicture}
\begin{axis}[symbolic x coords={a,b,c,d,e,f,g,h,i}]
\addplot+[smooth] coordinates {
(a,42)
(b,50)
(c,80)
(f,60)
(g,62)
(i,90)};
\end{axis}
\end{tikzpicture}

Unfortunately i did get the required result. I am using ubuntu Mevrick. Could any one guide me how i can plat the bar graphs having x axis labels

share|improve this question
    
Welcome to tex.sx! A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button (with "101010" on it). –  Hendrik Vogt Jan 24 '11 at 13:50
    
possible duplicate of Basic bar chart with text as x axis labels –  Caramdir Jan 24 '11 at 16:19
    
The packages in Ubuntu are outdated. See tex.stackexchange.com/questions/8582/… (I'm voting to close as duplicate. If the linked question does not help, please say so and give additional information.) –  Caramdir Jan 24 '11 at 16:21

1 Answer 1

up vote 2 down vote accepted

The code you posted should result in a smoothed line plot. You want the option ybar instead of smooth in the \addplot line. Here's a complete example:

\documentclass{minimal}

\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}

\begin{axis}[symbolic x coords={a,b,c,d,e,f,g,h,i},
xtick={a,b,c,d,e,f,g,h,i},  % Use this to decide which tickmarks to print
xticklabel style={text height=2ex}, % This aligns all letters on the same line, if it is missing, 'a' and 'b' are at different heights
ymin=0] 

\addplot[ybar,fill] coordinates {
(a,42)
(b,50)
(c,80)
(f,60)
(g,62)
(i,90) };

\end{axis}

\end{tikzpicture}
\end{document}

column plot with text x axis labels

share|improve this answer
    
I used your code this time but i got only a frame without any graphs the values on x-axis are, 0 0.2 0.4 0.6 0.8 11 1 –  user3119 Jan 24 '11 at 14:16
    
@survivor You probably have an outdated version of pgfplots. See this answer for details. –  Jake Jan 24 '11 at 14:24
    
@survivor: I am using Ubuntu Maverick with the latest TeX Live 2010 (not the version that comes with the distribution) and Jake's sample code works perfectly. Dig deeper. –  Heisenb0rg Jan 24 '11 at 14:31
    
I used the under given link for upgrading PGFplots, –  user3119 Jan 24 '11 at 14:54
1  
@survivor: if you use the version of TeX Live that comes with your Ubuntu distribution then it's TeX Live 2009 with pgfplots 1.2.2, I think. The command is "dpkg -l texlive*", mind the first column with the status values. To get the latest version, you need to remove TeX Live 2009 and install the latest version from here: tug.org/texlive It works flawlessly on Ubuntu Maverick. –  Heisenb0rg Jan 24 '11 at 15:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.