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/path_effects/text-shadow.html below:

Demo with shadow path — mpl_visual_context 0.9.3 documentation

mpl_visual_context Demo with shadow path

Inspired by the example in scientific visualization book by N. P. Rougier.

import numpy as np

from matplotlib.patheffects import Normal
from mpl_visual_context.patheffects import FillColor, AlphaGradient
from mpl_visual_context.patheffects_shadow import ShadowPath

import matplotlib.pyplot as plt

red = np.array([233, 77, 85, 255]) / 255
darkred = np.array([130, 60, 71, 255]) / 255

fig, ax = plt.subplots(num=2, clear=True)
t = ax.text(0.5, 0.5, "Matplotlib", ha="center", va="center",
            size=60, color="w", clip_on=True)
t.set_path_effects([ShadowPath(45, 180) | FillColor(darkred)
                    | AlphaGradient("0 ^ 0.1 ^ 0.3 ^ 0.5"),
                    Normal(),
                    ])

ax.patch.set_fc(red)

plt.show()

Total running time of the script: (0 minutes 0.083 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