3

I've got to plot an histogram with pgfplots where a single x value assumes a large value on the y-axis (14000) while the remaining data are all under 150... I'd like some suggestions on how to handle the plotting. I would like to have the plot scaled in order to have a good view of those data under 150 but at the same time it should report the largest value... Any suggestion?

    \documentclass{article}
    \usepackage{pgfplots}

    \begin{document}

    \begin{figure}
    \begin{center}
        \definecolor{mycolor1}{rgb}{0.00000,0.44700,0.74100}%
        %
        \begin{tikzpicture}
        \begin{axis}[
        scale only axis,
        xmin=0,
        xmax=10,
        xmajorgrids,
        ymin=0,
        ymax=20000,
        ymajorgrids
        ]
        \addplot[ycomb,color=mycolor1,solid,mark=o,mark options={solid}] plot            table[row sep=crcr] {%
            0   20000\\
            1   126.220647721184\\
            2   136.394614023852\\
            3   21.1680012089801\\
            4   113.520374296189\\
            5   143.838641199471\\
            6   41.9123247298389\\
            7   98.5479898078184\\
            8   148.403736993507\\
            9   61.8177727862635\\
            10  81.6031666334055\\
        };
        \end{axis}
        \end{tikzpicture}%
    \end{center}
    \end{figure}

    \end{document}
7
  • Could you please add a minimal working example (MWE) with some example data to play with? Also, have you considered an axis break somewhere above 150? Apr 5, 2015 at 20:33
  • 4
    Yes, logarithms!
    – percusse
    Apr 5, 2015 at 20:39
  • Unfortunately, that's not an MWE. Could you please expand it according to the link I posted above? Apr 5, 2015 at 21:19
  • I added a MWE.... I think I should use axis y discontinuity
    – Kevin
    Apr 5, 2015 at 21:48
  • 2
    Only change the axis to semilogyaxis or add the option ymode=log and you'll see one suggestion.
    – percusse
    Apr 5, 2015 at 23:52

0

Browse other questions tagged .