선 그래프가 있는 pgf 누적 막대 그래프

선 그래프가 있는 pgf 누적 막대 그래프

하나의 매개변수를 사용하여 누적 막대 그래프 플롯을 선 플롯으로 그리고 싶습니다. 아래 내 코드는 다음과 같습니다.

\begin{tikzpicture}
\pgfplotstableread{Figures/measurements.dat}
\datatable

\definecolor{RYB1}{RGB}{51, 102, 153}
\definecolor{RYB2}{RGB}{102, 51, 0}
\definecolor{RYB3}{RGB}{204, 153, 0}
\definecolor{RYB4}{RGB}{51, 51, 0}
\definecolor{RYB5}{RGB}{204, 102, 0}

\pgfplotscreateplotcyclelist{colorbrewer-RYB}{
    {fill=RYB1},
    {fill=RYB2},
    {fill=RYB3},
    {fill=RYB4},
    {fill=RYB5},
    }

\begin{axis}[
symbolic x coords={1.2.1.a,1.2.3.b,1.1.3.c,1.1.1.d,1.3.1.e,1.3.3.f,3.3.3.g,1.3.3.h,1.1.3.i,1.1.1.j,1.2.1.k,1.3.1.l},
ybar stacked,
legend style={
    legend columns=4,
    at={(xticklabel cs:0.5)},
    anchor=north,
    draw=none
},  
axis y line*=none,
axis x line*=bottom,
tick label style={font=\footnotesize},
legend style={font=\footnotesize},
label style={font=\footnotesize},
width=.8\textwidth,
bar width=6mm,
area legend,
x tick label style={rotate=90,anchor=east},    
xlabel=Processor Configuration,
ylabel=Clock Cycles,
cycle list name=colorbrewer-RYB,
xtick=data,
xticklabels={1.2.1,1.2.3,1.1.3,1.1.1,1.3.1,1.3.3,3.3.3,1.3.3,1.1.3,1.1.1,1.2.1,1.3.1},
]        
    \addplot table[y=C] from \datatable ; 
    \addlegendentry{C};
    \addplot table[y=E] from \datatable ;
    \addlegendentry{E};
    \addplot table[y=F] from \datatable ;
    \addlegendentry{F};
    \addplot table[y=D] from \datatable ;
    \addlegendentry{D};
\end{axis}
\end{tikzpicture}

그리고 여기에 데이터 파일이 있습니다 -

 A  B   C   D   E   F   G
1.2.1.a 2044238 2025137 138 15859   1400    1358
1.2.3.b 2108559 2088724 894 14662   1898    2035
1.1.3.c 3498648 3482495 1610    11490   1405    1302
1.1.1.d 2097564 2089859 871 5021    898 569
1.3.1.e 3489783 3470704 138 15888   1405    1302
1.3.3.f 3496917 3481357 871 11110   1909    1324
3.3.3.g 2110448 2089855 871 16015   2476    885
1.3.3.h 4897582 4875299 1375    17401   1903    1258
1.1.3.i 2800891 2786201 877 10704   1405    1358
1.1.1.j 2740737 2733003 894 5027    898 569
1.2.1.k 3500439 3481371 138 15882   1400    1302
1.3.1.l 2111014 2088720 894 18347   1405    1302

이제 이 그래프에서 매개변수 D를 막대 그래프가 아닌 선 그래프로 표시하고 싶습니다. 누구든지 이를 실현하기 위해 코드에 무엇을 추가해야 하는지 말해 줄 수 있습니까?

감사해요 !

답변1

그래서 여기에 내 문제를 해결한 최종 코드가 있습니다.

\begin{tikzpicture}
  \pgfplotstableread{Figures/measurements.dat}
  \datatable

  \definecolor{RYB1}{RGB}{51, 102, 153}
  \definecolor{RYB2}{RGB}{102, 51, 0}
  \definecolor{RYB3}{RGB}{204, 153, 0}
  \definecolor{RYB4}{RGB}{51, 51, 0}
  \definecolor{RYB5}{RGB}{204, 102, 0}
  \pgfplotscreateplotcyclelist{colorbrewer-RYB}{
    {fill=RYB1},
    {fill=RYB2},
    {fill=RYB3},
    {fill=RYB4},
    {fill=RYB5},
    }   

 \begin{axis}[
symbolic x coords={1.2.1.a,1.2.3.b,1.1.3.c,1.1.1.d,1.3.1.e,1.3.3.f,3.3.3.g,1.3.3.h,1.1.3.i,1.1.1.j,1.2.1.k,1.3.1.l},
ybar stacked,
legend style={
    legend columns=4,
    at={(xticklabel cs:0.5)},
    anchor=north,
    draw=none
},  
axis y line*=none,
axis x line*=bottom,
tick label style={font=\footnotesize},
legend style={font=\footnotesize},
width=.8\textwidth,
bar width=6mm,
x tick label style={rotate=90,anchor=east},
xlabel=Processor Configuration,
ylabel=Clock Cycles,
cycle list name=colorbrewer-RYB,
xtick=data,
xticklabels={1.2.1,1.2.3,1.1.3,1.1.1,1.3.1,1.3.3,3.3.3,1.3.3,1.1.3,1.1.1,1.2.1,1.3.1},
x label style={at={(0.5,-0.15)}},
]
\addplot table[y=C] from \datatable ; 
\addlegendentry{C};
\addplot table[y=E] from \datatable ;
\addlegendentry{E};
\addplot table[y=F] from \datatable ;
\addlegendentry{F};
 \addplot [line legend, thick, sharp plot, stack plots=false] table[y=D] from \datatable ;
\addlegendentry{D};

\end{axis}
\end{tikzpicture}

관련 정보