Skip to content

Commit

Permalink
Make analysis colours into \providecolor names
Browse files Browse the repository at this point in the history
See issue #11
  • Loading branch information
hex539 committed Jan 2, 2020
1 parent e8f3e51 commit a1c1543
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 18 deletions.
45 changes: 32 additions & 13 deletions analysis/res/java/me/hex539/analysis/activity.tex.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usetikzlibrary{patterns}
\providecolor{Accepted}{named}{LimeGreen}
\providecolor{WrongAnswer}{named}{Red}
\providecolor{TimeLimit}{named}{Plum}
\providecolor{RunError}{named}{Goldenrod}
\providecolor{Pending}{named}{SkyBlue}
\pgfplotsset{compat=1.15}
\begin{document}
\pgfplotstableread{
Expand All @@ -15,24 +20,39 @@ endfor
%}
}\attempts
\pgfplotsset{
/pgfplots/bar cycle list/.style={/pgfplots/cycle list=
{ {Green,fill=LimeGreen},% Accepted
{Red,fill=Red},% Wrong-Answer
{Plum,fill=Plum},% Time-Limit
{Goldenrod,fill=Goldenrod},% Compile-Error / Runtime-Error
{SkyBlue,fill=SkyBlue},% Pending 1
{SkyBlue,fill=SkyBlue},% Pending 2
{White,fill=White,opacity=0}}% Prevent clipping
}
/pgfplots/bar cycle list/.style={/pgfplots/cycle list=
{ {Accepted,fill=Accepted},
{WrongAnswer,fill=WrongAnswer},
{TimeLimit,fill=TimeLimit},
{RunError,fill=RunError},
{Pending,fill=Pending},
{White,fill=White,opacity=0}}% = Prevent clipping
}
}%
\makeatletter \newcommand{\pgfplotsdrawaxis}{\pgfplots@draw@axis} \makeatother
\pgfplotsset{axis line on top/.style={
axis line style=transparent,
ticklabel style=transparent,
tick style=transparent,
axis on top=false,
after end axis/.append code={
\pgfplotsset{axis line style=opaque,
ticklabel style=opaque,
tick style=opaque,
grid=none}
\pgfplotsdrawaxis}
}
}
\begin{tikzpicture}
\begin{axis}[
% axis lines=none,
axis x line=center,
axis y line=none,
axis line style={-},
axis line on top,
clip=false,
xmin=0,
xmax={{ (accepted|length) }},
ymin=0,
width={{ 20 }}cm,
bar width={{ 15.0 / (accepted|length) }}cm,
height=5cm,
Expand All @@ -43,9 +63,8 @@ endfor
\addplot table[x=t,y expr={-\thisrow{wronganswer}}] {\attempts};
\addplot table[x=t,y expr={-\thisrow{timelimit}}] {\attempts};
\addplot table[x=t,y expr={-\thisrow{failed}}] {\attempts};
\addplot table[x=t,y expr={+\thisrow{pending}*1}] {\attempts};
\addplot table[x=t,y expr={-\thisrow{pending}*0}] {\attempts};
\addplot table[x=t,y expr={-5}] {\attempts};
\addplot table[x=t,y expr={+\thisrow{pending}}] {\attempts};
\addplot table[x=t,y expr={-4}] {\attempts};
\end{axis}
\end{tikzpicture}
\end{document}
15 changes: 10 additions & 5 deletions analysis/res/java/me/hex539/analysis/language_stats.tex.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usetikzlibrary{patterns}
\providecolor{Accepted}{named}{LimeGreen}
\providecolor{WrongAnswer}{named}{Red}
\providecolor{TimeLimit}{named}{Plum}
\providecolor{RunError}{named}{Goldenrod}
\providecolor{Pending}{named}{SkyBlue}
\pgfplotsset{compat=1.14}
\begin{document}
\pgfplotstableread{
Expand All @@ -25,11 +30,11 @@ endfor
}\attempts
\pgfplotsset{
/pgfplots/bar cycle list/.style={/pgfplots/cycle list=
{ {draw=none,fill=LimeGreen},% Accepted
{draw=none,fill=Red},% Wrong-Answer
{draw=none,fill=Plum},% Time-Limit
{draw=none,fill=Goldenrod},% Compile-Error / Runtime-Error
{draw=none,fill=SkyBlue} % Pending
{ {draw=none,fill=Accepted},
{draw=none,fill=WrongAnswer},
{draw=none,fill=TimeLimit},
{draw=none,fill=RunError},
{draw=none,fill=Pending}
}
},
/pgfplots/ybar legend/.style={
Expand Down

0 comments on commit a1c1543

Please sign in to comment.