Hi Stephane

You could check out the library Groupplots in the pgfplots manual. As i am
not really with a TeX compatible machine i cant compile, but from what i
just could figure you needed the groupplots library..

Kind regards Nick

2010/11/18 Stephane <s.l...@laposte.net>

> Hi,
> i have tried to represent multiple bar plots for different categories, with
> error bar, all at once in the same plot. You will figure best what I mean
> to do
> with the very busy tikz code copied below. i was wondering if this could be
> done
> with pgfplots in a more elegant way.
> Thank you all in advance
> Best
> Stephane
>
> \documentclass{article}
> \usepackage{tikz}
>
> \begin{document}
>
> \def\groupe{6}
> \def\inter{10}
> \def\intra{1}
> \def\lbar{8}
> \def\nbar{6}
>
> \pgfmathsetmacro{\d}{(\nbar*\lbar+\nbar*\intra+\inter)/2} %distance inter
> groupe
> \pgfmathsetmacro{\l}{\lbar+\intra} % distance inter bar
> \pgfmathsetmacro{\c}{\l*(\nbar-1)/2} % centre groupe
> \pgfmathsetmacro{\e}{(\lbar+\inter)/2} % décalage x
> \pgfmathsetmacro{\f}{-20} % décalage y
>
> \begin{tikzpicture}
>
> \begin{scope}[ycomb,line width=\lbar pt]
> \draw[color=green,xshift=-5*\d pt] %F_HET_FRA
> plot coordinates{(0,1.43) (\l pt,1.08) (2*\l pt,1.12) (3*\l pt,.91) (4*\l
> pt,1.1)(5*\l pt,.81)};
> \draw[color=orange,xshift=-3*\d pt] %F_HET_FOR
> plot coordinates{(0,1.55) (\l pt,1.36) (2*\l pt,1.16) (3*\l pt,1.08) (4*\l
> pt,1.03)(5*\l pt,.94)};
> \draw[color=red, xshift=-\d pt] %M_HET_FRA
> plot coordinates{(0,1.36) (\l pt,1.51) (2*\l pt,1.51) (3*\l pt,1.38) (4*\l
> pt,1.27)(5*\l pt,1.14)};
> \draw[color=black!50,xshift=\d pt] %M_HET_FOR
> plot coordinates{(0,.93) (\l pt,1.02) (2*\l pt,.85) (3*\l pt,.64) (4*\l
> pt,.66)(5*\l pt,.66)};
> \draw[color=blue!60,xshift=3*\d pt] %MSM
> plot coordinates{(0,3.48) (\l pt,2.97) (2*\l pt,3.33) (3*\l pt,2.93) (4*\l
> pt,3.34)(5*\l pt,3.32)};
> \draw[color=red!50,xshift=5*\d pt]%IDU
> plot coordinates{(0,.18) (\l pt,.22) (2*\l pt,.16) (3*\l pt,.14) (4*\l
> pt,.14)(5*\l pt,.07)};
> \end{scope}
> %
> %--------- CI
> %a
> \begin{scope}[|-|,thin,xshift=-5*\d pt]
> \draw (0,1.07)--(0,1.79);
> \draw  (\l pt,.84)--(\l pt,1.31);
> \draw (2*\l pt,.9)--(2*\l pt,1.35);
> \draw (3*\l pt,.7)--(3*\l pt,1.13);
> \draw (4*\l pt,.86)--(4*\l pt,1.33);
> \draw (5*\l pt,.62)--(5*\l pt,1);
> \end{scope}
> %b
> \begin{scope}[|-|,thin,xshift=-3*\d pt]
> \draw (0,1.16)--(0,1.93);
> \draw  (\l pt,1.1)--(\l pt,1.62);
> \draw (2*\l pt,.93)--(2*\l pt,1.39);
> \draw (3*\l pt,.88)--(3*\l pt,1.27);
> \draw (4*\l pt,.82)--(4*\l pt,1.25);
> \draw (5*\l pt,.7)--(5*\l pt,1.18);
> \end{scope}
> %c
> \begin{scope}[|-|,thin,xshift=-1*\d pt]
> \draw (0,.93)--(0,1.79);
> \draw  (\l pt,1.21)--(\l pt,1.81);
> \draw (2*\l pt,1.16)--(2*\l pt,1.86);
> \draw (3*\l pt,1.08)--(3*\l pt,1.69);
> \draw (4*\l pt,.94)--(4*\l pt,1.59);
> \draw (5*\l pt,.83)--(5*\l pt,1.44);
> \end{scope}
> %d
> \begin{scope}[|-|,thin,xshift=1*\d pt]
> \draw (0,.67)--(0,1.19);
> \draw  (\l pt,.79)--(\l pt,1.26);
> \draw (2*\l pt,.58)--(2*\l pt,1.12);
> \draw (3*\l pt,.45)--(3*\l pt,.83);
> \draw (4*\l pt,.52)--(4*\l pt,.79);
> \draw (5*\l pt,.45)--(5*\l pt,.87);
> \end{scope}
> %e
> \begin{scope}[|-|,thin,xshift=3*\d pt]
> \draw (0,2.74)--(0,4.22);
> \draw  (\l pt,2.44)--(\l pt,3.5);
> \draw (2*\l pt,2.81)--(2*\l pt,3.84);
> \draw (3*\l pt,2.5)--(3*\l pt,3.36);
> \draw (4*\l pt,2.93)--(4*\l pt,3.75);
> \draw (5*\l pt,2.83)--(5*\l pt,3.81);
> \end{scope}
> %f
> \begin{scope}[|-|,thin,xshift=5*\d pt]
> \draw (0,.07)--(0,.3);
> \draw  (\l pt,.11)--(\l pt,.33);
> \draw (2*\l pt,.07)--(2*\l pt,.26);
> \draw (3*\l pt,.05)--(3*\l pt,.23);
> \draw (4*\l pt,.06)--(4*\l pt,.22);
> \draw (5*\l pt,0)--(5*\l pt,.19);
> \end{scope}
>
> %%---------- axes
> \draw[->]  (7*\d-\e pt,0)--(-5*\d-\e pt,0)--(-5*\d-\e pt,4.5) node[above]
> {N};
> %
> %---------- légendes
> \begin{scope}[text width=53 pt,text centered]
> \draw[xshift=-5*\d pt] (\c pt,\f pt) node{\small{a}};
> \draw[xshift=-3*\d pt] (\c pt,\f pt) node{\small{b}};
> \draw[xshift=-1*\d pt] (\c pt,\f pt) node{\small{c}};
> \draw[xshift=1*\d pt] (\c pt,\f pt) node {\small{d}};
> \draw[xshift=3*\d pt] (\c pt,\f pt) node {\small{e}};
> \draw[xshift=5*\d pt] (\c pt,\f pt) node {\small{f}};
> \end{scope}
>
> \foreach \x in {        -3*\d, -1*\d, 1*\d, 3*\d, 5*\d, 7*\d}{
> \draw[] (\x-\e pt,0)--(\x-\e pt,-0.1);}%
> \foreach \y in {1000,2000,...,4000}{
> \pgfmathsetmacro{\b}{\y/1000}
> \draw[] (-5*\d-\e pt,\b)--(-5*\d-\e-2 pt,\b) node[left] {\y};}
>
> \foreach \x in {-5*\d, -3*\d, -1*\d, 1*\d, 3*\d, 5*\d}{
>
> \begin{scope}[xshift=\x pt]
> \draw (- 4 pt,-15pt)--(\nbar*\l -5 pt,-15pt);
> \draw (0,0) node[below]{\footnotesize{3}};
> \draw (\l pt,0) node[below]{\footnotesize{4}};
> \draw (2*\l pt,0) node[below]{\footnotesize{5}};
> \draw (3*\l pt,0) node[below]{\footnotesize{6}};
> \draw (4*\l pt,0) node[below]{\footnotesize{7}};
> \draw (5*\l pt,0) node[below]{\footnotesize{8}};
> \end{scope}}
>
> \end{tikzpicture}
>
> \end{document}
>
>
>
>
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today
> http://p.sf.net/sfu/msIE9-sfdev2dev
> _______________________________________________
> Pgfplots-features mailing list
> Pgfplots-features@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pgfplots-features
>
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Pgfplots-features mailing list
Pgfplots-features@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pgfplots-features

Reply via email to