From 99b2957bcfbebfc8ebe708e893eab4ba223fc645 Mon Sep 17 00:00:00 2001 From: joelostblom Date: Sat, 14 Jul 2018 18:45:12 -0400 Subject: [PATCH 1/3] Sort named colors vertically for easier comparison of similar colors --- examples/color/named_colors.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/color/named_colors.py b/examples/color/named_colors.py index 80ea924eb425..c7348bfba8ea 100644 --- a/examples/color/named_colors.py +++ b/examples/color/named_colors.py @@ -25,9 +25,9 @@ n = len(sorted_names) ncols = 4 -nrows = n // ncols + 1 +nrows = n // ncols -fig, ax = plt.subplots(figsize=(8, 5)) +fig, ax = plt.subplots(figsize=(12, 10)) # Get height and width X, Y = fig.get_dpi() * fig.get_size_inches() @@ -35,8 +35,8 @@ w = X / ncols for i, name in enumerate(sorted_names): - col = i % ncols - row = i // ncols + row = i % nrows + col = i // nrows y = Y - (row * h) - h xi_line = w * (col + 0.05) @@ -48,7 +48,7 @@ verticalalignment='center') ax.hlines(y + h * 0.1, xi_line, xf_line, - color=colors[name], linewidth=(h * 0.6)) + color=colors[name], linewidth=(h * 0.8)) ax.set_xlim(0, X) ax.set_ylim(0, Y) From de0af533ef5ddada23aeda1ed382a2402eefc65f Mon Sep 17 00:00:00 2001 From: joelostblom Date: Sat, 14 Jul 2018 19:43:02 -0400 Subject: [PATCH 2/3] Shrink figure size --- examples/color/named_colors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/color/named_colors.py b/examples/color/named_colors.py index c7348bfba8ea..a0f6d1cb7dc3 100644 --- a/examples/color/named_colors.py +++ b/examples/color/named_colors.py @@ -27,7 +27,7 @@ ncols = 4 nrows = n // ncols -fig, ax = plt.subplots(figsize=(12, 10)) +fig, ax = plt.subplots(figsize=(9, 7.5)) # Get height and width X, Y = fig.get_dpi() * fig.get_size_inches() From cc0df1fd54e3234195868408f4b4c72fc7c20e33 Mon Sep 17 00:00:00 2001 From: joelostblom Date: Sat, 14 Jul 2018 19:58:10 -0400 Subject: [PATCH 3/3] Adjust formatting to look good outside the jupyter notebook --- examples/color/named_colors.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/color/named_colors.py b/examples/color/named_colors.py index a0f6d1cb7dc3..5a16c2d813f1 100644 --- a/examples/color/named_colors.py +++ b/examples/color/named_colors.py @@ -27,7 +27,7 @@ ncols = 4 nrows = n // ncols -fig, ax = plt.subplots(figsize=(9, 7.5)) +fig, ax = plt.subplots(figsize=(9, 8)) # Get height and width X, Y = fig.get_dpi() * fig.get_size_inches() @@ -43,12 +43,12 @@ xf_line = w * (col + 0.25) xi_text = w * (col + 0.3) - ax.text(xi_text, y, name, fontsize=(h * 0.8), + ax.text(xi_text, y, name, fontsize=(h * 0.5), horizontalalignment='left', verticalalignment='center') ax.hlines(y + h * 0.1, xi_line, xf_line, - color=colors[name], linewidth=(h * 0.8)) + color=colors[name], linewidth=(h * 0.6)) ax.set_xlim(0, X) ax.set_ylim(0, Y)