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/demo_gradient.html below:

Website Navigation


Gradient & AlphaGradient — mpl_visual_context 0.9.3 documentation

Gradient & AlphaGradient
import numpy as np

import matplotlib.pyplot as plt

from mpl_visual_context.patheffects import (Gradient, AlphaGradient)
from mpl_visual_context.patheffects import (StrokeOnly,
                                            StrokeColor, FillColor,
                                            GCModify)
from matplotlib.patheffects import Normal

fig, ax = plt.subplots(num=1, clear=True)

t1 = ax.text(0.5, 0.2, "ImageBox", size=60,
             color="g", va="center", ha="center")

t2 = ax.text(0.5, 0.5, "ImageBox", size=60,
             color="g", va="center", ha="center")

t3 = ax.text(0.5, 0.8, "ImageBox", size=60,
             color="g", va="center", ha="center")


t1.set_path_effects([
    AlphaGradient("up"),
])

t2.set_path_effects([
    GCModify(linewidth=15) | StrokeColor("k") | StrokeOnly(),
    GCModify(linewidth=7) | StrokeColor("w") | StrokeOnly(),
    Gradient("right"),
])

t3.set_path_effects([
    GCModify(linewidth=5) | StrokeColor("k") | StrokeOnly(),
    FillColor("w"),
    Gradient("right", "up", cmap="rainbow"),
])

plt.show()

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