vtraag / tikz-colorbrewer

Definition files providing colours as defined by the ColorBrewer project.
34 stars 7 forks source link

Doesn't work with bar charts #1

Open jdugge opened 10 years ago

jdugge commented 10 years ago

Great work on the library!

Feature request: Add cycle lists that work for bar plots (i.e. fill the bars), similar to the predefined standard bar cycle list

/pgfplots/bar cycle list/.style={/pgfplots/cycle list={%
    {blue,fill=blue!30!white,mark=none},%
    {red,fill=red!30!white,mark=none},%
    {brown!60!black,fill=brown!30!white,mark=none},%
    {black,fill=gray,mark=none},%
    {violet!80!black,fill=violet,mark=none},%
    {green,fill=green!80!black,mark=none}%
    }
}

Admittedly, doing this would mean being holier than the pope, since the built-in cycle lists like exotic and black white don't work for bar plots either. It would still be nice to have, though, since bar plots are a pretty common plot type that really profits from having a proper categorical colour scheme.


Test case:

\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{colorbrewer}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
    ybar,
    samples=3,
    cycle list name=Set1-3
]
\addplot {rnd};
\addplot {rnd};
\addplot {rnd};
\end{axis}
\end{tikzpicture}
\end{document}

screenshot from 2014-09-02 20 13 50

vtraag commented 10 years ago

Yes, good idea. I also already added a style for when using actual markers (similar issues appear there).