0

I have a problem, and I don't know how I can solve this :(

Could you please help me?

The parameter "Fim de Vida" does not plote in graficMy Grafic.

\documentclass[a4paper]{report}
enter code here\usepackage{xcolor}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usetikzlibrary{calc}
\usepgfplotslibrary{dateplot}
\pgfplotsset{compat=newest}
\pgfplotsset{
        show sum on top/.style={
            /pgfplots/scatter/@post marker code/.append code={%
                \path let \p1=($(normalized axis cs:%
                            \pgfkeysvalueof{/data point/x},%
                            \pgfkeysvalueof{/data point/y})%
                            -(normalized axis cs:\pgfkeysvalueof{/data point/x},0)$)
                in node[
                    at={(normalized axis cs:%
                            \pgfkeysvalueof{/data point/x},%
                            \pgfkeysvalueof{/data point/y})%
                    },
                    anchor={-90*sign(\y1)},yshift={sign(\y1)*2pt}
                ]
                {\pgfmathprintnumber{\pgfkeysvalueof{/data point/y}}};
            },
        },
    }
\begin{document}
 \pgfplotstableread{
Year    OneCol  SecCol  ThirdCol ForthCol FifthCol SixthCol
1    6.58E-08 1.44E-08 5.42E-08 4.02E-08 2.30E-08 -6.02E-09 
2    2.42E-09 3.17E-10 1.19E-09 8.85E-10 5.07E-10 -1.22E-10
3    1.53E-08 3.17E-10 1.19E-09 8.85E-10 5.54E-10 6.88E-10
}\datatable

\begin{figure}
\centering
 \begin{tikzpicture}
    \begin{axis}[
      width=0.9*\textwidth,
      bar width=0.26cm,
      tick label style={/pgf/number format/1000 sep=,font=\footnotesize},
      ybar stacked,
      stack negative=on previous, %<- moved down
      bar width=1em,
      ymin=-5.00E-08,
      axis on top,
      ymax=2.50E-07,
      ymajorgrids = true,
      enlarge x limits={true, abs value=0.75},
      height=8cm,
      nodes near coords={},
      legend style={
      at={(1.1,0.5)},
      anchor=west,
      draw=none },
      xtick=data,
      xticklabels={Cenário Um, Cenário Dois, Cenário Três}
      ]
      \addplot [fill=cyan!70,draw=black!70] table [y index=1] {\datatable};
      \addplot [fill=green!90,draw=black!70] table [y index=2] {\datatable};
      \addplot [fill=teal!90,draw=black!70]table [y index=3] {\datatable};
      \addplot [fill=violet!90,draw=black!70]table [y index=4] {\datatable};
      \addplot [fill=lime!90,draw=black!70]table [y index=5] {\datatable};
      \addplot [fill=magenta!90,draw=black!70]table [y index=6] {\datatable};
  \legend{Bateria, Estrutura,Motor,Pneu,Uso,Final de Vida}
    \end{axis}
  \end{tikzpicture}
  \caption{Impacts by category relative to baseline building with conventional building envelope}
\label{relative}
  \end{figure}
0

Try replacing stack negative=on previous with stack negative=separate.

But note that one of the negative values is very close to zero. You will not be able to see it in the graph.

  • It workssss =) Thank you very much – Thaise Campos Aug 17 '19 at 20:40

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.