It seems like whenever I turn on Fading from Tikz Fading library, the nodes near coords parameter to the axis environment is not processed by PGFPlots correctly. I am attaching the code and the image I get. (While some may argue that fading the bar graph represents no additional information, it helps me to divert attention of audience to the part where there is no fading). In the following code, the red and yellow graphs have fading enabled while blue and green plots have fading disabled. Secondly, the fade option seems to be such that the fading does not happen for each bar in the bar chart, but a group of bars are being faded (for example, the red plot). Is there a way I can get the fades for each bar and also get nodes near coords?


0.00000000e+00 2.00000000e+00
 5.00000000e-01 0.00000000e+00
 1.00000000e+00 3.00000000e+00
 1.50000000e+00 3.00000000e+00
 2.00000000e+00 4.00000000e+00
 2.50000000e+00 1.00000000e+00
 3.00000000e+00 2.00000000e+00
 3.50000000e+00 1.00000000e+00
 4.00000000e+00 2.00000000e+00
 4.50000000e+00 2.00000000e+00
 5.00000000e+00 3.00000000e+00
 5.50000000e+00 5.00000000e+00
 6.00000000e+00 3.00000000e+00
 6.50000000e+00 4.00000000e+00
 7.00000000e+00 7.00000000e+00
 7.50000000e+00 5.00000000e+00
 8.00000000e+00 4.00000000e+00
 8.50000000e+00 0.00000000e+00
 9.00000000e+00 2.00000000e+00
 9.50000000e+00 2.00000000e+00
 1.00000000e+01 1.00000000e+00
 1.05000000e+01 0.00000000e+00
 1.10000000e+01 3.00000000e+00
 1.15000000e+01 2.00000000e+00
 1.20000000e+01 0.00000000e+00
 1.25000000e+01 0.00000000e+00
 1.30000000e+01 1.00000000e+00
 1.35000000e+01 0.00000000e+00
 1.40000000e+01 0.00000000e+00
 1.45000000e+01 0.00000000e+00
 1.50000000e+01 0.00000000e+00


    xticklabel style={rotate=45},
    legend columns=-1,
    nodes near coords,
    every node near coord/.append style={
    inner sep=1pt,
    major grid style={thick,white},
    axis on top,
    tick pos=left,
    xlabel=Total Points in Quiz-1,
    ylabel=Number of Students,
    x label style={at={(axis description cs:0.5,-0.05)},anchor=north},
    title={\bf Performance of students in Quiz-1}

        \addplot+[path fading=east,color=red!30,draw=black,forget plot] table [y index=1,x index=0,skip coords between index={5}{31}]{Total_Histogram.dat};
        \addplot+[path fading=south,color=yellow!30,draw=black,forget plot] table [y index=1,x index=0,skip coords between index={0}{5},skip coords between index={11}{31}]{Total_Histogram.dat};
        \addplot+[color=blue!30,draw=black,forget plot] table [y index=1,x index=0,skip coords between index={0}{11},skip coords between index={17}{31}]{Total_Histogram.dat};
        \addplot+[color=green!30,draw=black] table [y index=1,x index=0,skip coords between index={0}{17}]{Total_Histogram.dat};

        \node [fill=red!30,,decoration={random steps,segment length=6pt,amplitude=2pt},decorate] at (axis cs:0.65,3.75) {Attention};
        \node [fill=yellow!30] at (axis cs:3.5,3.75) {C,D grades};
        \node [fill=blue!30] at (axis cs:7,7.35) {B grade};
        \node [fill=green!30] at (axis cs:11,3.75) {A,S grades};
        \draw [->,blue,ultra thick] (axis cs:5.9,0) -- (axis cs:5.9,6.5) node [anchor=north east,draw=gray,xshift=-1.5mm]{Average=5.9};
        \draw [<->,gray,ultra thick]    (axis cs:-0.1,5.4) -- (axis cs:5.8,5.4) node [anchor=north,midway]{28 Students};
        \draw [<->,gray,ultra thick]    (axis cs:6.0,5.4) -- (axis cs:15,5.4) node [anchor=north,midway]{34 Students};



Incorrect fading and disappearance of nodes near coords in pgfplots

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.