Skip to content

Commit bd0f310

Browse files
fixed grouped bar figs
1 parent eeabff6 commit bd0f310

File tree

1 file changed

+30
-12
lines changed

1 file changed

+30
-12
lines changed
Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
21
\DeclareRobustCommand{\plot}[2][]{
32
\begin{tikzpicture}
43
\begin{axis}[
5-
width=\textwidth, height=0.6172\textwidth,
4+
width=0.95\textwidth, height=0.6172\textwidth,
65
xlabel={ {{xaxis.label}} }, ylabel={ {{yaxis.label}} },
76
xtick=data, xtick align=outside,
7+
ylabel style={font=\scriptsize},
8+
xlabel style={font=\scriptsize},
89
xticklabels from table={{'{#2}'}}{{'{'}}{{xaxis.parameter}}{{'}'}},
10+
xticklabel style={rotate=45, anchor=east, font=\scriptsize},
11+
yticklabel style={font=\scriptsize},
912
ymajorgrids=true, yminorgrids=true,
1013
bar width=7pt,
1114
cycle list name=color list,
1215
ybar,
13-
legend style={at={(0.5,-0.1)},anchor=north}
16+
legend to name=customlegend,
17+
legend style={font=\small}
1418
]
1519
{% for col in columns %}
1620
\addplot table [x expr=\coordindex, y={{ col }}] {{'{#2}'}} ;
@@ -28,14 +32,28 @@
2832

2933

3034
\begin{figure}[H]
35+
\centering
36+
{% if anim_dimension_values %}
37+
{% set n = anim_dimension_values | length %}
38+
{% set ncols = (n**0.5) | round(0, 'ceil') %}
39+
{% set nrows = (n / ncols) | round(0, 'ceil') %}
40+
{% set subfig_width = ((0.95 / ncols) | round(3)) %}
3141

32-
{% if anim_dimension_values %}
33-
{% for dim in anim_dimension_values %}
34-
\plot{\data{{ loop.index | inttouniquestr }}}
35-
\caption{ {{secondary_axis.label}}={{dim}} }
36-
{% endfor %}
37-
{% else %}
38-
\plot{\data{{1 | inttouniquestr }}}
39-
{% endif %}
40-
\caption{ {{caption}} }
42+
{% for dim in anim_dimension_values %}
43+
\begin{subfigure}[t]{ {{subfig_width}}\textwidth}
44+
\centering
45+
\plot{\data{{ loop.index | inttouniquestr }}}
46+
\caption{ {{secondary_axis.label}}={{dim}} }
47+
\end{subfigure}
48+
{% if (loop.index0 + 1) % ncols == 0 %}
49+
\par\vspace{1em}
50+
{% endif %}
51+
{% endfor %}
52+
{% else %}
53+
\plot{\data{{1 | inttouniquestr }}}
54+
{% endif %}
55+
\vspace{1em}
56+
\centering
57+
\pgfplotslegendfromname{customlegend}
58+
\caption{ {{caption}} }
4159
\end{figure}

0 commit comments

Comments
 (0)