From 118bfccdd49fb93c8ee37393bb750535cce232ca Mon Sep 17 00:00:00 2001 From: Jae-Joon Lee Date: Mon, 24 Oct 2022 22:36:47 +0900 Subject: [PATCH 1/2] fix demo_agg_filter.py --- examples/misc/demo_agg_filter.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/examples/misc/demo_agg_filter.py b/examples/misc/demo_agg_filter.py index d03b5ae2ae3c..a7a213d2492e 100644 --- a/examples/misc/demo_agg_filter.py +++ b/examples/misc/demo_agg_filter.py @@ -99,8 +99,19 @@ def process_image(self, padded_src, dpi): class LightFilter(BaseFilter): - - def __init__(self, sigma, fraction=0.5): + """Apply LightSource filter""" + + def __init__(self, sigma, fraction=1): + """ + Parameters + ---------- + sigma : float + sigma for gaussian filter + fraction: number: deault 1 + Increases or decreases the contrast of the hillshade. + See `matplotlib.colors.LightSource` + + """ self.gauss_filter = GaussianFilter(sigma, alpha=1) self.light_source = LightSource() self.fraction = fraction @@ -114,7 +125,8 @@ def process_image(self, padded_src, dpi): rgb = padded_src[:, :, :3] alpha = padded_src[:, :, 3:] rgb2 = self.light_source.shade_rgb(rgb, elevation, - fraction=self.fraction) + fraction=self.fraction, + blend_mode="overlay") return np.concatenate([rgb2, alpha], -1) @@ -257,7 +269,7 @@ def drop_shadow_patches(ax): def light_filter_pie(ax): fracs = [15, 30, 45, 10] - explode = (0, 0.05, 0, 0) + explode = (0.1, 0.2, 0.1, 0.1) pies = ax.pie(fracs, explode=explode) light_filter = LightFilter(9) @@ -267,7 +279,7 @@ def light_filter_pie(ax): p.set(ec="none", lw=2) - gauss = DropShadowFilter(9, offsets=(3, 4), alpha=0.7) + gauss = DropShadowFilter(9, offsets=(3, -4), alpha=0.7) shadow = FilteredArtistList(pies[0], gauss) ax.add_artist(shadow) shadow.set_zorder(pies[0][0].get_zorder() - 0.1) From 443c3bfdca2b35ee80af6cf98ace3455b35ee10c Mon Sep 17 00:00:00 2001 From: Jae-Joon Lee Date: Tue, 25 Oct 2022 13:26:32 +0900 Subject: [PATCH 2/2] Update examples/misc/demo_agg_filter.py Co-authored-by: Elliott Sales de Andrade --- examples/misc/demo_agg_filter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/misc/demo_agg_filter.py b/examples/misc/demo_agg_filter.py index a7a213d2492e..0cdbf81f50b5 100644 --- a/examples/misc/demo_agg_filter.py +++ b/examples/misc/demo_agg_filter.py @@ -107,7 +107,7 @@ def __init__(self, sigma, fraction=1): ---------- sigma : float sigma for gaussian filter - fraction: number: deault 1 + fraction: number, default: 1 Increases or decreases the contrast of the hillshade. See `matplotlib.colors.LightSource` 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