From abeae04bf4e68188cd6c0b59c51c608d89f7ad71 Mon Sep 17 00:00:00 2001 From: Eero Vaher Date: Mon, 30 Jan 2023 21:11:02 +0100 Subject: [PATCH] Stop recommending `ncol` in legend examples Since 958e329b198a9036fc121d11775815ded7c9acad the preferred keyword for controlling the number of columns in a legend is `ncols`, but some code examples have still been using `ncol`. --- .../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 600dcad92ba2..778391920936 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 6fc0efa20cd7..8c87d09dc157 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 29ace420a14f..9839be18022e 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