From 2d0a5b4159156ef73d96d70d42216bc8e4c91968 Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Mon, 30 Jan 2023 16:59:23 -0600 Subject: [PATCH] Backport PR #25110: Stop recommending `ncol` in legend examples --- .../lines_bars_and_markers/horizontal_barchart_distribution.py | 2 +- examples/text_labels_and_annotations/legend_demo.py | 2 +- examples/user_interfaces/mplcvd.py | 2 +- examples/userdemo/simple_legend01.py | 2 +- tutorials/intermediate/legend_guide.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/lines_bars_and_markers/horizontal_barchart_distribution.py b/examples/lines_bars_and_markers/horizontal_barchart_distribution.py index 3a22ce3ed4ae..3ec12ba00e8d 100644 --- a/examples/lines_bars_and_markers/horizontal_barchart_distribution.py +++ b/examples/lines_bars_and_markers/horizontal_barchart_distribution.py @@ -60,7 +60,7 @@ def survey(results, category_names): r, g, b, _ = color text_color = 'white' if r * g * b < 0.5 else 'darkgrey' ax.bar_label(rects, label_type='center', color=text_color) - ax.legend(ncol=len(category_names), bbox_to_anchor=(0, 1), + ax.legend(ncols=len(category_names), bbox_to_anchor=(0, 1), loc='lower left', fontsize='small') return fig, ax diff --git a/examples/text_labels_and_annotations/legend_demo.py b/examples/text_labels_and_annotations/legend_demo.py index 0dc0858f3cc4..11df93095fe4 100644 --- a/examples/text_labels_and_annotations/legend_demo.py +++ b/examples/text_labels_and_annotations/legend_demo.py @@ -47,7 +47,7 @@ for n in range(1, 5): ax0.plot(x, x**n, label=f"{n=}") leg = ax0.legend(loc="upper left", bbox_to_anchor=[0, 1], - ncol=2, shadow=True, title="Legend", fancybox=True) + ncols=2, shadow=True, title="Legend", fancybox=True) leg.get_title().set_color("red") # Demonstrate some more complex labels. diff --git a/examples/user_interfaces/mplcvd.py b/examples/user_interfaces/mplcvd.py index e65cb7d26a3b..8eaa22a8977a 100644 --- a/examples/user_interfaces/mplcvd.py +++ b/examples/user_interfaces/mplcvd.py @@ -295,5 +295,5 @@ def _setup_wx(tb): th = np.linspace(0, 2*np.pi, 1024) for j in [1, 2, 4, 6]: axd['lines'].plot(th, np.sin(th * j), label=f'$\\omega={j}$') - axd['lines'].legend(ncol=2, loc='upper right') + axd['lines'].legend(ncols=2, loc='upper right') plt.show() diff --git a/examples/userdemo/simple_legend01.py b/examples/userdemo/simple_legend01.py index c80488d1ad2d..2aaac1424558 100644 --- a/examples/userdemo/simple_legend01.py +++ b/examples/userdemo/simple_legend01.py @@ -15,7 +15,7 @@ # Place a legend above this subplot, expanding itself to # fully use the given bounding box. ax.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc='lower left', - ncol=2, mode="expand", borderaxespad=0.) + ncols=2, mode="expand", borderaxespad=0.) ax = fig.add_subplot(223) ax.plot([1, 2, 3], label="test1") diff --git a/tutorials/intermediate/legend_guide.py b/tutorials/intermediate/legend_guide.py index 338fca72fbf1..0fbe4b2d3526 100644 --- a/tutorials/intermediate/legend_guide.py +++ b/tutorials/intermediate/legend_guide.py @@ -127,7 +127,7 @@ # Place a legend above this subplot, expanding itself to # fully use the given bounding box. ax_dict['top'].legend(bbox_to_anchor=(0., 1.02, 1., .102), loc='lower left', - ncol=2, mode="expand", borderaxespad=0.) + ncols=2, mode="expand", borderaxespad=0.) ax_dict['bottom'].plot([1, 2, 3], label="test1") ax_dict['bottom'].plot([3, 2, 1], label="test2") pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy