Skip to content

Commit 778ea4a

Browse files
authored
Merge pull request #465 from nschloe/legend-options
cleaner legend options
2 parents 0ce8f23 + facc415 commit 778ea4a

15 files changed

+257
-41
lines changed

test/test_basic_sin_reference.tex

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@
77
axis background/.style={fill=white!89.803922!black},
88
axis line style={white},
99
legend cell align={left},
10-
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, at={(0.03,0.03)}, anchor=south west, draw=white!80!black, fill=white!89.803922!black},
10+
legend style={
11+
fill opacity=0.8,
12+
draw opacity=1,
13+
text opacity=1,
14+
at={(0.03,0.03)},
15+
anchor=south west,
16+
draw=white!80!black,
17+
fill=white!89.803922!black
18+
},
1119
tick align=outside,
1220
tick pos=left,
1321
title={Simple plot \(\displaystyle \frac{\alpha}{2}\)},

test/test_legend3_reference.tex

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22

33
\begin{axis}[
44
legend cell align={left},
5-
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, at={(0.03,0.97)}, anchor=north west, draw=white!80!black},
5+
legend style={
6+
fill opacity=0.8,
7+
draw opacity=1,
8+
text opacity=1,
9+
at={(0.03,0.97)},
10+
anchor=north west,
11+
draw=white!80!black
12+
},
613
tick align=outside,
714
tick pos=left,
815
x grid style={white!69.019608!black},

test/test_legend_best_location_reference.tex

Lines changed: 56 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,14 @@
4343

4444
\nextgroupplot[
4545
legend cell align={left},
46-
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, at={(0.03,0.97)}, anchor=north west, draw=white!80!black},
46+
legend style={
47+
fill opacity=0.8,
48+
draw opacity=1,
49+
text opacity=1,
50+
at={(0.03,0.97)},
51+
anchor=north west,
52+
draw=white!80!black
53+
},
4754
scaled x ticks=manual:{}{\pgfmathparse{#1}},
4855
scaled y ticks=manual:{}{\pgfmathparse{#1}},
4956
tick align=outside,
@@ -80,7 +87,14 @@
8087

8188
\nextgroupplot[
8289
legend cell align={left},
83-
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, at={(0.03,0.03)}, anchor=south west, draw=white!80!black},
90+
legend style={
91+
fill opacity=0.8,
92+
draw opacity=1,
93+
text opacity=1,
94+
at={(0.03,0.03)},
95+
anchor=south west,
96+
draw=white!80!black
97+
},
8498
scaled x ticks=manual:{}{\pgfmathparse{#1}},
8599
scaled y ticks=manual:{}{\pgfmathparse{#1}},
86100
tick align=outside,
@@ -117,7 +131,14 @@
117131

118132
\nextgroupplot[
119133
legend cell align={left},
120-
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, at={(0.03,0.03)}, anchor=south west, draw=white!80!black},
134+
legend style={
135+
fill opacity=0.8,
136+
draw opacity=1,
137+
text opacity=1,
138+
at={(0.03,0.03)},
139+
anchor=south west,
140+
draw=white!80!black
141+
},
121142
scaled x ticks=manual:{}{\pgfmathparse{#1}},
122143
tick align=outside,
123144
tick pos=left,
@@ -152,7 +173,14 @@
152173

153174
\nextgroupplot[
154175
legend cell align={left},
155-
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, at={(0.91,0.5)}, anchor=east, draw=white!80!black},
176+
legend style={
177+
fill opacity=0.8,
178+
draw opacity=1,
179+
text opacity=1,
180+
at={(0.91,0.5)},
181+
anchor=east,
182+
draw=white!80!black
183+
},
156184
scaled x ticks=manual:{}{\pgfmathparse{#1}},
157185
scaled y ticks=manual:{}{\pgfmathparse{#1}},
158186
tick align=outside,
@@ -207,7 +235,14 @@
207235

208236
\nextgroupplot[
209237
legend cell align={left},
210-
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, at={(0.09,0.5)}, anchor=west, draw=white!80!black},
238+
legend style={
239+
fill opacity=0.8,
240+
draw opacity=1,
241+
text opacity=1,
242+
at={(0.09,0.5)},
243+
anchor=west,
244+
draw=white!80!black
245+
},
211246
scaled x ticks=manual:{}{\pgfmathparse{#1}},
212247
scaled y ticks=manual:{}{\pgfmathparse{#1}},
213248
tick align=outside,
@@ -282,7 +317,14 @@
282317

283318
\nextgroupplot[
284319
legend cell align={left},
285-
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, at={(0.5,0.09)}, anchor=south, draw=white!80!black},
320+
legend style={
321+
fill opacity=0.8,
322+
draw opacity=1,
323+
text opacity=1,
324+
at={(0.5,0.09)},
325+
anchor=south,
326+
draw=white!80!black
327+
},
286328
tick align=outside,
287329
tick pos=left,
288330
x grid style={white!69.019608!black},
@@ -315,7 +357,14 @@
315357

316358
\nextgroupplot[
317359
legend cell align={left},
318-
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, at={(0.5,0.91)}, anchor=north, draw=white!80!black},
360+
legend style={
361+
fill opacity=0.8,
362+
draw opacity=1,
363+
text opacity=1,
364+
at={(0.5,0.91)},
365+
anchor=north,
366+
draw=white!80!black
367+
},
319368
scaled y ticks=manual:{}{\pgfmathparse{#1}},
320369
tick align=outside,
321370
tick pos=left,

test/test_legend_columns_reference.tex

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@
66
\begin{axis}[
77
legend cell align={left},
88
legend columns=2,
9-
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, at={(0.5,0.91)}, anchor=north, draw=white!80!black},
9+
legend style={
10+
fill opacity=0.8,
11+
draw opacity=1,
12+
text opacity=1,
13+
at={(0.5,0.91)},
14+
anchor=north,
15+
draw=white!80!black
16+
},
1017
tick align=outside,
1118
tick pos=left,
1219
x grid style={white!69.019608!black},

test/test_legend_line_scatter_reference.tex

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@
44

55
\begin{axis}[
66
legend cell align={left},
7-
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, at={(0.03,0.97)}, anchor=north west, draw=white!80!black},
7+
legend style={
8+
fill opacity=0.8,
9+
draw opacity=1,
10+
text opacity=1,
11+
at={(0.03,0.97)},
12+
anchor=north west,
13+
draw=white!80!black
14+
},
815
tick align=outside,
916
tick pos=left,
1017
x grid style={white!69.019608!black},

test/test_legends2_reference.tex

Lines changed: 72 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@
66
\begin{groupplot}[group style={group size=3 by 3}]
77
\nextgroupplot[
88
legend cell align={left},
9-
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, at={(0.03,0.97)}, anchor=north west, draw=white!80!black},
9+
legend style={
10+
fill opacity=0.8,
11+
draw opacity=1,
12+
text opacity=1,
13+
at={(0.03,0.97)},
14+
anchor=north west,
15+
draw=white!80!black
16+
},
1017
scaled x ticks=manual:{}{\pgfmathparse{#1}},
1118
tick align=outside,
1219
tick pos=left,
@@ -54,7 +61,14 @@
5461

5562
\nextgroupplot[
5663
legend cell align={left},
57-
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, at={(0.03,0.03)}, anchor=south west, draw=white!80!black},
64+
legend style={
65+
fill opacity=0.8,
66+
draw opacity=1,
67+
text opacity=1,
68+
at={(0.03,0.03)},
69+
anchor=south west,
70+
draw=white!80!black
71+
},
5872
scaled x ticks=manual:{}{\pgfmathparse{#1}},
5973
scaled y ticks=manual:{}{\pgfmathparse{#1}},
6074
tick align=outside,
@@ -104,7 +118,14 @@
104118

105119
\nextgroupplot[
106120
legend cell align={left},
107-
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, at={(0.97,0.03)}, anchor=south east, draw=white!80!black},
121+
legend style={
122+
fill opacity=0.8,
123+
draw opacity=1,
124+
text opacity=1,
125+
at={(0.97,0.03)},
126+
anchor=south east,
127+
draw=white!80!black
128+
},
108129
scaled x ticks=manual:{}{\pgfmathparse{#1}},
109130
scaled y ticks=manual:{}{\pgfmathparse{#1}},
110131
tick align=outside,
@@ -154,7 +175,14 @@
154175

155176
\nextgroupplot[
156177
legend cell align={left},
157-
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, at={(0.97,0.5)}, anchor=east, draw=white!80!black},
178+
legend style={
179+
fill opacity=0.8,
180+
draw opacity=1,
181+
text opacity=1,
182+
at={(0.97,0.5)},
183+
anchor=east,
184+
draw=white!80!black
185+
},
158186
scaled x ticks=manual:{}{\pgfmathparse{#1}},
159187
tick align=outside,
160188
tick pos=left,
@@ -202,7 +230,14 @@
202230

203231
\nextgroupplot[
204232
legend cell align={left},
205-
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, at={(0.09,0.5)}, anchor=west, draw=white!80!black},
233+
legend style={
234+
fill opacity=0.8,
235+
draw opacity=1,
236+
text opacity=1,
237+
at={(0.09,0.5)},
238+
anchor=west,
239+
draw=white!80!black
240+
},
206241
scaled x ticks=manual:{}{\pgfmathparse{#1}},
207242
scaled y ticks=manual:{}{\pgfmathparse{#1}},
208243
tick align=outside,
@@ -252,7 +287,14 @@
252287

253288
\nextgroupplot[
254289
legend cell align={left},
255-
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, at={(0.91,0.5)}, anchor=east, draw=white!80!black},
290+
legend style={
291+
fill opacity=0.8,
292+
draw opacity=1,
293+
text opacity=1,
294+
at={(0.91,0.5)},
295+
anchor=east,
296+
draw=white!80!black
297+
},
256298
scaled x ticks=manual:{}{\pgfmathparse{#1}},
257299
scaled y ticks=manual:{}{\pgfmathparse{#1}},
258300
tick align=outside,
@@ -302,7 +344,14 @@
302344

303345
\nextgroupplot[
304346
legend cell align={left},
305-
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, at={(0.5,0.09)}, anchor=south, draw=white!80!black},
347+
legend style={
348+
fill opacity=0.8,
349+
draw opacity=1,
350+
text opacity=1,
351+
at={(0.5,0.09)},
352+
anchor=south,
353+
draw=white!80!black
354+
},
306355
tick align=outside,
307356
tick pos=left,
308357
x grid style={white!69.019608!black},
@@ -348,7 +397,14 @@
348397

349398
\nextgroupplot[
350399
legend cell align={left},
351-
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, at={(0.5,0.91)}, anchor=north, draw=white!80!black},
400+
legend style={
401+
fill opacity=0.8,
402+
draw opacity=1,
403+
text opacity=1,
404+
at={(0.5,0.91)},
405+
anchor=north,
406+
draw=white!80!black
407+
},
352408
scaled y ticks=manual:{}{\pgfmathparse{#1}},
353409
tick align=outside,
354410
tick pos=left,
@@ -396,7 +452,14 @@
396452

397453
\nextgroupplot[
398454
legend cell align={left},
399-
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, at={(0.5,0.5)}, anchor=center, draw=white!80!black},
455+
legend style={
456+
fill opacity=0.8,
457+
draw opacity=1,
458+
text opacity=1,
459+
at={(0.5,0.5)},
460+
anchor=center,
461+
draw=white!80!black
462+
},
400463
scaled y ticks=manual:{}{\pgfmathparse{#1}},
401464
tick align=outside,
402465
tick pos=left,

test/test_scatter_colormap.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,10 @@ def plot():
1818

1919
def test():
2020
assert_equality(plot, __file__[:-3] + "_reference.tex")
21-
return
21+
22+
23+
if __name__ == "__main__":
24+
import matplotlib.pyplot as plt
25+
26+
plot()
27+
plt.show()

test/test_scatter_colormap_reference.tex

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
ytick style={color=black}
1212
]
1313
\addplot [
14-
colormap/viridis,
15-
only marks,
16-
scatter,
17-
scatter src=explicit,
18-
scatter/@pre marker code/.append style={/tikz/mark size=\perpointmarksize},
19-
visualization depends on={\thisrow{sizedata} \as\perpointmarksize}
14+
colormap/viridis,
15+
only marks,
16+
scatter,
17+
scatter src=explicit,
18+
scatter/@pre marker code/.append style={/tikz/mark size=\perpointmarksize},
19+
visualization depends on={\thisrow{sizedata} \as\perpointmarksize}
2020
]
2121
table [x=x, y=y, meta=colordata]{%
2222
x y colordata sizedata

test/test_scatter_different_colors_reference.tex

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@
1111
ytick style={color=black}
1212
]
1313
\addplot [
14-
mark=*,
15-
only marks,
16-
scatter,
17-
scatter/@post marker code/.code={%
14+
mark=*,
15+
only marks,
16+
scatter,
17+
scatter/@post marker code/.code={%
1818
\endscope
1919
},
20-
scatter/@pre marker code/.code={%
20+
scatter/@pre marker code/.code={%
2121
\expanded{%
2222
\noexpand\definecolor{thispointdrawcolor}{RGB}{\drawcolor}%
2323
\noexpand\definecolor{thispointfillcolor}{RGB}{\fillcolor}%
2424
}%
2525
\scope[draw=thispointdrawcolor, fill=thispointfillcolor]%
2626
},
27-
visualization depends on={value \thisrow{draw} \as \drawcolor},
28-
visualization depends on={value \thisrow{fill} \as \fillcolor}
27+
visualization depends on={value \thisrow{draw} \as \drawcolor},
28+
visualization depends on={value \thisrow{fill} \as \fillcolor}
2929
]
3030
table{%
3131
x y draw fill

0 commit comments

Comments
 (0)