Dear pgfplots developers!

First, thanks a lot for your great package.  I'm using it to create
diagrams in ConTeXt.  Please consider the following (M)WE.  I hope you
can run it, otherwise, you can see the output here:
http://666kb.com/i/cl5sdm34i4ig69mkk.png

\usemodule[pgfplots]
\pgfplotsset{compat=newest}

\pgfplotsset{HeartControl/.style=
{
        red, fill=red!33!white,
        bar shift=-0.1667
}}
\pgfplotsset{HeartDiabetes/.style=
{
        red!33!black, fill=red!66!white,
        bar shift=+0.1667
}}
\pgfplotsset{KidneyControl/.style=
{
        orange, fill=orange!33!white,
        bar shift=-0.1667
}}
\pgfplotsset{KidneyDiabetes/.style=
{
        orange!33!black, fill=orange!66!white,
        bar shift=+0.1667
}}

\pgfplotsset{/pgfplots/ybar legend/.style=
{
        /pgfplots/legend image code/.code={%
                \draw[
                        ##1, /tikz/.cd,
                        bar width=0.25em,
                        yshift=-0.27em,
                        bar shift=0pt
                ]
                plot coordinates {(0pt,0.8em)};
        }
}}

\starttext

\starttikzpicture
        \startaxis
        [
                ybar,
                xtick=data,
                ylabel={mRNA level},
                ymin=0,
                xmin=0.333, xmax=2.667,
                xtick={1,2}, xticklabels={Heart,Kidney},
                error bars/y dir=both,
                error bars/y explicit,
                bar width=0.3,
                legend columns=2,
                legend pos=outer north east,
                legend cell align=left
        ]

        \addplot+[HeartControl] coordinates {(1,1) +- (0,0.1)};
        \addplot+[KidneyControl] coordinates {(2,1) +- (0,0.12)};
        \addplot+[HeartDiabetes] coordinates {(1,1.1) +- (0,0.2)};
        \addplot+[KidneyDiabetes] coordinates {(2,0.8) +- (0,0.05)};
        
        \draw (axis cs:2,1.15) +(-2.2em,0) -- +(2.2em,0);
        \node[anchor=south, yshift=-1ex] at (axis cs:2,1.15) {*};

        \legend{{\kern-0.1em}, Control, {\kern-0.1em}, Diabetes}

        \stopaxis
\stoptikzpicture

\stoptext

As you can see, I have two groups (organs: hearts, kidneys), sometimes
more, and two conditions (control, Diabetes).  To make it easier to
compare the diagrams (there are many), I want to use consistent colours
for the same organs, and two brightnesses for the two conditions.  The
code above works, but automatic positioning would be much nicer, so I
could just set something like "bar width=..." and "bar seperation=..."
and let the bars be positioned automatically.  This would also allow me
to use symbolic coordinates, avoiding the pseudo coordinates (1 and
2).  Is there a better way to get the desired result than what I've
done?

I also hope there is a better way to create significance stars.  If two
values are significantly different, there is a horizontal line to be
added which spans the two bars, and a symbol above it.  The symbols
usually are one till three stars (depending on the degree of
significance), sometimes other symbols are used in the literature.  At
least it would be nice if I could define the coordinates for the
horizontal line with something like "max(errormark1, errormark2) +a",
ie, the higher of the two error marks involved plus some separation.

Kind regards,
Joshua Krämer



------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Pgfplots-features mailing list
Pgfplots-features@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pgfplots-features

Reply via email to