A RetroSearch Logo

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

Search Query:

Showing content from https://matplotlib.org/devdocs/devel/../gallery/lines_bars_and_markers/lines_with_ticks_demo.html below:

Lines with a ticked patheffect — Matplotlib 3.11.0.dev1077+g30f4ece3f5 documentation

Lines with a ticked patheffect#

Ticks can be added along a line to mark one side as a barrier using TickedStroke. You can control the angle, spacing, and length of the ticks.

The ticks will also appear appropriately in the legend.

import matplotlib.pyplot as plt
import numpy as np

from matplotlib import patheffects

# Plot a straight diagonal line with ticked style path
fig, ax = plt.subplots(figsize=(6, 6))
ax.plot([0, 1], [0, 1], label="Line",
        path_effects=[patheffects.withTickedStroke(spacing=7, angle=135)])

# Plot a curved line with ticked style path
nx = 101
x = np.linspace(0.0, 1.0, nx)
y = 0.3*np.sin(x*8) + 0.4
ax.plot(x, y, label="Curve", path_effects=[patheffects.withTickedStroke()])

ax.legend()

plt.show()

Tags: styling: linestyle plot-type: line level: beginner

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