Skip to content

Commit 0bb2379

Browse files
committed
fix(examples): disambiguate legend
1 parent f96bd93 commit 0bb2379

File tree

14 files changed

+20
-20
lines changed

14 files changed

+20
-20
lines changed

Diff for: examples/appearance/labels/legend/legend_1.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ int main() {
1212
std::vector<double> y2 = transform(x, [](auto x) { return cos(2 * x); });
1313
plot(x, y2);
1414

15-
legend("cos(x)", "cos(2x)");
15+
::matplot::legend({"cos(x)", "cos(2x)"});
1616

1717
std::vector<double> y3 = transform(x, [](auto x) { return cos(3 * x); });
1818
auto p = plot(x, y3);
@@ -21,7 +21,7 @@ int main() {
2121

2222
show();
2323

24-
legend(off);
24+
::matplot::legend(off);
2525
show();
2626

2727
return 0;

Diff for: examples/appearance/labels/legend/legend_2.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ int main() {
1313
auto ax2 = nexttile();
1414
plot(y2);
1515

16-
legend(ax1, "Line 1", "Line 2", "Line 3");
16+
::matplot::legend(ax1, {"Line 1", "Line 2", "Line 3"});
1717

1818
show();
1919
return 0;

Diff for: examples/appearance/labels/legend/legend_3.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ int main() {
1616
p2->display_name("cos(2x)");
1717
hold(off);
1818

19-
legend();
19+
::matplot::legend({});
2020

2121
show();
2222
return 0;

Diff for: examples/appearance/labels/legend/legend_4.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ int main() {
1717
plot(x, y4);
1818
hold(off);
1919

20-
auto l = legend("cos(x)", "cos(2x)", "cos(3x)", "cos(4x)");
20+
auto l = ::matplot::legend({"cos(x)", "cos(2x)", "cos(3x)", "cos(4x)"});
2121
l->location(legend::general_alignment::topleft);
2222
l->num_rows(2);
2323

Diff for: examples/appearance/labels/legend/legend_5.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ int main() {
1515
auto p3 = plot(x, y3);
1616
hold(off);
1717

18-
legend({p1, p3}, {"First", "Third"});
18+
::matplot::legend({p1, p3}, {"First", "Third"});
1919

2020
show();
2121
return 0;

Diff for: examples/appearance/labels/legend/legend_6.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ int main() {
1313
plot(x, y2);
1414
hold(off);
1515

16-
auto lgd = legend("cos(x)", "cos(2x)");
16+
auto lgd = ::matplot::legend({"cos(x)", "cos(2x)"});
1717
title(lgd, "My legend title");
1818

1919
show();

Diff for: examples/appearance/labels/legend/legend_7.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ int main() {
1313
plot(x, y2);
1414
hold(off);
1515

16-
auto lgd = legend("cos(x)", "cos(2x)");
16+
auto lgd = ::matplot::legend({"cos(x)", "cos(2x)"});
1717
lgd->location(legend::general_alignment::bottomleft);
1818
lgd->box(false);
1919

Diff for: examples/appearance/labels/legend/legend_8.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ int main() {
77

88
plot(rdm);
99

10-
auto lgd = legend("Line 1", "Line 2", "Line 3", "Line 4");
10+
auto lgd = ::matplot::legend({"Line 1", "Line 2", "Line 3", "Line 4"});
1111
lgd->font_size(12);
1212
lgd->text_color("blue");
1313
lgd->num_columns(2);

Diff for: examples/appearance/labels/legend/legend_9.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ int main() {
66

77
auto random_lines = rand(4, 4, 0, 1);
88
auto ls = plot(random_lines);
9-
legend("Line 1", "Line 2");
9+
::matplot::legend({"Line 1", "Line 2"});
1010
ls[2]->display_name("Line 3");
1111

1212
show();

Diff for: examples/appearance/multiplot/yyaxis/yyaxis_4.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ int main() {
1818
ps[1]->use_y2(true).color("m").line_style("--");
1919
gca()->y2_axis().color("m");
2020

21-
legend();
21+
::matplot::legend();
2222

2323
show();
2424
return 0;

Diff for: examples/appearance/multiplot/yyaxis/yyaxis_5.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ int main() {
2121
ax->y2_axis().color(ax->colororder()[1]);
2222
hold(off);
2323

24-
legend();
24+
::matplot::legend();
2525

2626
show();
2727
return 0;

Diff for: examples/data_distribution/histogram/histogram_14.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ int main() {
5858
subplot(2, 3, 0);
5959
title("Average - Normal / Gaussian - mean(x)= {∑ x_i}/{n} - x_i = N(0,1)");
6060
xlim({-4, 4});
61-
legend();
61+
::matplot::legend({});
6262
std::normal_distribution<double> d(0, 1);
6363
std::function<double()> normal_data_source = [&]() { return d(generator); };
6464
hist(bootstrap(mean<double>, normal_data_source, 1), n_bins)
@@ -104,7 +104,7 @@ int main() {
104104
subplot(2, 3, 1);
105105
title("Average - Uniform - mean(x)= {∑ x_i}/{n} - x_i = U(-1;+1)");
106106
xlim({-1, 1});
107-
legend();
107+
::matplot::legend({});
108108
std::uniform_real_distribution<double> u(-1.0, 1.0);
109109
std::function<double()> uniform_data_source = [&]() {
110110
return u(generator);
@@ -152,7 +152,7 @@ int main() {
152152
subplot(2, 3, 2);
153153
title("Sum of Squares - Chi-Squared - ∑ (x_i - mean(x))^2");
154154
xlim({0, 5});
155-
legend();
155+
::matplot::legend();
156156
double m = 0;
157157
auto chi2_data_source = [&]() {
158158
return pow(normal_data_source() - m, 2.0);
@@ -202,7 +202,7 @@ int main() {
202202
subplot(2, 3, 3);
203203
title("Square Root of Sum of Squares - Chi - √{∑ (x_i - mean(x))^2}");
204204
xlim({0, 4});
205-
legend();
205+
::matplot::legend({});
206206
auto chi_data_source = [&]() { return sqrt(chi2_data_source()); };
207207
hist(bootstrap(mean<double>, chi_data_source, 1), n_bins)
208208
->normalization(norm)
@@ -247,7 +247,7 @@ int main() {
247247
<< std::endl;
248248
subplot(2, 3, 4);
249249
title("Variance ratio - F - σ_1 / σ_2");
250-
legend();
250+
::matplot::legend({});
251251
m = 0.0;
252252
auto ratio_ss = [&]() { return chi2_data_source() / chi2_data_source(); };
253253
xlim({0, 5});
@@ -297,7 +297,7 @@ int main() {
297297
subplot(2, 3, 5);
298298
title("Average - Bernoulli - mean(x)= {∑ x_i}/{n} - x_i = B(1/6)");
299299
xlim({0, 1});
300-
legend();
300+
::matplot::legend();
301301
std::bernoulli_distribution b(1. / 6.);
302302
std::function<double()> bernoulli_data_source = [&]() {
303303
return static_cast<double>(b(generator));

Diff for: examples/line_plot/loglog/loglog_5.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ int main() {
1212

1313
loglog(x, y1, x, y2, "--");
1414

15-
legend("Signal 1", "Signal 2")
15+
::matplot::legend({"Signal 1", "Signal 2"})
1616
->location(legend::general_alignment::topleft);
1717

1818
axis({0.1, 100, 2, 8});

Diff for: examples/polar_plots/polarscatter/polarscatter_5.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ int main() {
1313
polarscatter(theta, rho2, "filled");
1414
hold(off);
1515

16-
auto l = legend("Series A", "Series B");
16+
auto l = ::matplot::legend({"Series A", "Series B"});
1717
l->location(legend::general_alignment::topright);
1818

1919
show();

0 commit comments

Comments
 (0)