From aad5a2f3481acac062a95da8f084ec7604b76577 Mon Sep 17 00:00:00 2001 From: Guangyang Li Date: Sun, 6 Oct 2019 03:13:12 -0700 Subject: [PATCH] Simplify the code --- docs/examples/icons.md | 6 +- examples/docs/basic_dict_values.svg | 102 ++-- examples/docs/basic_list_values.svg | 102 ++-- .../docs/block_color_and_background_color.svg | 102 ++-- ..._and_background_color_custom_cmap_name.svg | 102 ++-- examples/docs/icons_different_style.svg | 141 +---- examples/docs/title_label_ledend.svg | 102 ++-- ...caling_and_auto_columns_ignore_columns.svg | 196 +++---- ...scaling_and_auto_columns_rounding_rule.svg | 98 ++-- examples/generate_plots.py | 6 +- examples/readme/absolute_block_numbers.svg | 196 +++---- examples/readme/basic.svg | 102 ++-- examples/readme/multiple_plots.svg | 506 +++++++++--------- examples/readme/title_and_legend.svg | 196 +++---- pywaffle/waffle.py | 8 +- 15 files changed, 941 insertions(+), 1024 deletions(-) diff --git a/docs/examples/icons.md b/docs/examples/icons.md index a564a3b..9670212 100644 --- a/docs/examples/icons.md +++ b/docs/examples/icons.md @@ -50,12 +50,12 @@ fig = plt.figure( rows=5, values=[48, 46, 3], colors=["#FFA500", "#4384FF", "#C0C0C0"], - icons=['sun', 'cloud-showers-heavy', 'snowflake'], + icons=['sun', 'cloud-showers-heavy', 'font-awesome-flag'], icon_size=12, - icon_style=['regular', 'solid', 'regular'], + icon_style=['regular', 'solid', 'brands'], icon_legend=False, legend={ - 'labels': ['sun', 'shower', 'snow'], + 'labels': ['sun', 'shower', 'flag'], 'loc': 'upper left', 'bbox_to_anchor': (1, 1) } diff --git a/examples/docs/basic_dict_values.svg b/examples/docs/basic_dict_values.svg index fadb7f1..f744ca0 100644 --- a/examples/docs/basic_dict_values.svg +++ b/examples/docs/basic_dict_values.svg @@ -19,7 +19,7 @@ z - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/examples/docs/basic_list_values.svg b/examples/docs/basic_list_values.svg index 39e608e..24cee3e 100644 --- a/examples/docs/basic_list_values.svg +++ b/examples/docs/basic_list_values.svg @@ -19,7 +19,7 @@ z - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/examples/docs/block_color_and_background_color.svg b/examples/docs/block_color_and_background_color.svg index 8f51f16..aeb3bc3 100644 --- a/examples/docs/block_color_and_background_color.svg +++ b/examples/docs/block_color_and_background_color.svg @@ -19,7 +19,7 @@ z - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/examples/docs/block_color_and_background_color_custom_cmap_name.svg b/examples/docs/block_color_and_background_color_custom_cmap_name.svg index f65109e..a0ced60 100644 --- a/examples/docs/block_color_and_background_color_custom_cmap_name.svg +++ b/examples/docs/block_color_and_background_color_custom_cmap_name.svg @@ -19,7 +19,7 @@ z - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/examples/docs/icons_different_style.svg b/examples/docs/icons_different_style.svg index a63e42f..8d2cf4a 100644 --- a/examples/docs/icons_different_style.svg +++ b/examples/docs/icons_different_style.svg @@ -710,128 +710,45 @@ z - + - +" id="FontAwesome5Brands-Regular-62501"/> - + - + - + - + - + @@ -1050,9 +967,9 @@ z - + - + diff --git a/examples/docs/title_label_ledend.svg b/examples/docs/title_label_ledend.svg index ca63d7f..76d28c8 100644 --- a/examples/docs/title_label_ledend.svg +++ b/examples/docs/title_label_ledend.svg @@ -19,7 +19,7 @@ z - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/examples/docs/value_scaling_and_auto_columns_ignore_columns.svg b/examples/docs/value_scaling_and_auto_columns_ignore_columns.svg index 6ec7297..49c1792 100644 --- a/examples/docs/value_scaling_and_auto_columns_ignore_columns.svg +++ b/examples/docs/value_scaling_and_auto_columns_ignore_columns.svg @@ -19,7 +19,7 @@ z - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/examples/docs/value_scaling_and_auto_columns_rounding_rule.svg b/examples/docs/value_scaling_and_auto_columns_rounding_rule.svg index e30d21f..0f94718 100644 --- a/examples/docs/value_scaling_and_auto_columns_rounding_rule.svg +++ b/examples/docs/value_scaling_and_auto_columns_rounding_rule.svg @@ -19,7 +19,7 @@ z - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/examples/generate_plots.py b/examples/generate_plots.py index 5ed4fad..82a72e5 100644 --- a/examples/generate_plots.py +++ b/examples/generate_plots.py @@ -215,10 +215,10 @@ rows=5, values=[48, 46, 3], colors=["#FFA500", "#4384FF", "#C0C0C0"], - icons=['sun', 'cloud-showers-heavy', 'snowflake'], + icons=['sun', 'cloud-showers-heavy', 'font-awesome-flag'], icon_size=12, - icon_style=['regular', 'solid', 'regular'], + icon_style=['regular', 'solid', 'brands'], icon_legend=True, - legend={'labels': ['sun', 'shower', 'snow'], 'loc': 'upper left', 'bbox_to_anchor': (1, 1)} + legend={'labels': ['sun', 'shower', 'flag'], 'loc': 'upper left', 'bbox_to_anchor': (1, 1)} ) fig.savefig(doc_examples_image_folder + 'icons_different_style.svg', bbox_inches='tight') \ No newline at end of file diff --git a/examples/readme/absolute_block_numbers.svg b/examples/readme/absolute_block_numbers.svg index f1f115e..aacb5d4 100644 --- a/examples/readme/absolute_block_numbers.svg +++ b/examples/readme/absolute_block_numbers.svg @@ -19,7 +19,7 @@ z - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/examples/readme/basic.svg b/examples/readme/basic.svg index 5603b3d..8966f4b 100644 --- a/examples/readme/basic.svg +++ b/examples/readme/basic.svg @@ -19,7 +19,7 @@ z - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/examples/readme/multiple_plots.svg b/examples/readme/multiple_plots.svg index fad4255..a717fdd 100644 --- a/examples/readme/multiple_plots.svg +++ b/examples/readme/multiple_plots.svg @@ -19,7 +19,7 @@ z - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + diff --git a/examples/readme/title_and_legend.svg b/examples/readme/title_and_legend.svg index f64055f..cbcd014 100644 --- a/examples/readme/title_and_legend.svg +++ b/examples/readme/title_and_legend.svg @@ -19,7 +19,7 @@ z - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/pywaffle/waffle.py b/pywaffle/waffle.py index f85e2be..cf93ff5 100644 --- a/pywaffle/waffle.py +++ b/pywaffle/waffle.py @@ -81,7 +81,7 @@ def __init__(self, text, color, **kwargs): class TextLegendHandler(HandlerBase): def __init__(self, font_file): super().__init__() - self.font_file = FONTAWESOME_FILES[font_file] + self.font_file = font_file def create_artists(self, legend, orig_handle, xdescent, ydescent, width, height, fontsize, trans): x = xdescent + width / 2.0 @@ -98,9 +98,9 @@ def create_artists(self, legend, orig_handle, xdescent, ydescent, width, height, HANDLER_MAP = { - SolidTextLegend: TextLegendHandler('solid'), - RegularTextLegend: TextLegendHandler('regular'), - BrandsTextLegend: TextLegendHandler('brands') + SolidTextLegend: TextLegendHandler(FONTAWESOME_FILES['solid']), + RegularTextLegend: TextLegendHandler(FONTAWESOME_FILES['regular']), + BrandsTextLegend: TextLegendHandler(FONTAWESOME_FILES['brands']) }