1

enter image description here

Hello everyone!

I do not know how to create a bar chart with a persoalization with pgfplots. I have questions with the command and settings. I tried to make some additions with ycomb and scatter, but to no avail.

Thank you and awaiting.

Follow de code:

\documentclass{article}
\usepackage{pgfplots}
\usepackage{file contents}
\pagestyle{empty}

    \begin{document}
         \begin{tikzpicture}
            \begin{axis}[%
            ycomb,
        legend style={
            at={(0.5,-0.15)},
            anchor=north,legend columns=-1},
        scatter/classes={%
            a={blue},%
            b={red},%
            c={yellow}}]
        \addplot[
        scatter,
        scatter src=explicit symbolic]%
        table[meta=label] {
            x  y label
            1.0 1 a 
            1.1 1 c 
            1.2 1 a 
            1.3 1 a 
            1.4 1 b 
            1.5 1 c 
            1.6 1 b 
            1.7 1 a 
            1.8 1 b 
            1.9 1 c 
            2.0 1 b 
            2.1 1 c
        };
        \legend{a,b,c}
        \end{axis}
        \end{tikzpicture}
\end{document}

marsupilam

Friend, good afternoon.

You really are right. I tried to make an adaptation with the scatter, through my readings, I managed to put the "ycomb" to create a line. However, I could not fit the category color line.

After your comment, I realized that what I wanted to do is what you said. The histogram from the categories.

I do not know where to post the comments.

Am I on the right path?

I'm sorry, my friend, I used the translator.

I want to make a bar graph (histogram) with the scatter features. That is, the bars will have colors from the category. I've tried setting up a few things from web searches. The closest I got was the image I posted. The colored circles from the category and the line in black color.

Thank you and waiting for your help.

Alex
  • 11

0 Answers0