A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mpl-visual-context.readthedocs.io/en/latest/examples/image_effect/text_image_effect.html below:

Website Navigation


Image Effect — mpl_visual_context 0.9.3 documentation

Image Effect
import numpy as np
from matplotlib.patheffects import AbstractPathEffect, Normal
from matplotlib import cbook
import matplotlib.pyplot as plt
from mpl_visual_context.patheffects import StrokeOnly, GCModify, ImageEffect

from abc import abstractmethod


fig, ax = plt.subplots(num=1, clear=True)
t1 = ax.text(
    0.5,
    0.5,
    "M",
    size=100,
    color="y",
    weight="bold",
    va="center",
    ha="center",
)

t2 = ax.text(
    1.5,
    0.5,
    "M",
    size=100,
    color="r",
    weight="bold",
    va="center",
    ha="center",
)

ax.set_xlim(0, 2)

from mpl_visual_context.image_effect import (
    AlphaAxb,
    Pad,
    Fill,
    Dilation,
    Gaussian,
    Offset,
)

import mpl_visual_context.patheffects as pe
from mpl_visual_context.image_effect import LightSource, LightSourceSharp


shadow = ImageEffect(
    AlphaAxb((0.3, 0)) | Pad(15) | Fill("k") | Dilation(2) | Gaussian(3) | Offset(5, -5)
)

t1.set_path_effects([
    shadow,
    ImageEffect(Pad(10) | LightSource(azdeg=215))
])

t2.set_path_effects([
    shadow,
    ImageEffect(Pad(10) | LightSourceSharp(azdeg=215))
])

plt.show()

Total running time of the script: (0 minutes 0.056 seconds)

Gallery generated by Sphinx-Gallery


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4