Skip to content

Instantly share code, notes, and snippets.

View TarickWake's full-sized avatar
🐍

Clément T. TarickWake

🐍
View GitHub Profile
@TarickWake
TarickWake / draw_loglog_slope.py
Created June 6, 2024 10:58 — forked from w1th0utnam3/draw_loglog_slope.py
A helper function for Matplotlib to draw "convergence triangles" into loglog plots.
import matplotlib as mpl
def draw_loglog_slope(fig, ax, origin, width_inches, slope, inverted=False, color=None, polygon_kwargs=None, label=True, labelcolor=None, label_kwargs=None, zorder=None):
"""
This function draws slopes or "convergence triangles" into loglog plots.
@param fig: The figure
@param ax: The axes object to draw to
@param origin: The 2D origin (usually lower-left corner) coordinate of the triangle
@param width_inches: The width in inches of the triangle