Chris Parmer — home

Hello world

a single arrow, from (0, 0) to (1, 2)

Example from a field guide to quiver · shared helpers

Hello world — a single arrow, from (0, 0) to (1, 2)

Python Code

"""Hello world — a single arrow, from (0, 0) to (1, 2)."""
from pathlib import Path

from _shared import save, themed_layout, VIOLET

CHART_NUM = 0


def generate():
    arrow = {
        "type": "quiver",
        "x": [0],  # the arrow's tail sits here…
        "y": [0],
        "u": [1],  # …and it points one unit right
        "v": [2],  # …and two units up
        # raw + data: the tip lands exactly on (1, 2)
        "arrowref": "data",
        "lengthmode": "raw",
        "marker": {"color": VIOLET, "line": {"width": 4}},
        "showlegend": False,
    }
    layout = themed_layout(
        xaxis={"range": [-0.5, 1.7]},
        yaxis={"range": [-0.3, 2.3], "scaleanchor": "x"},
    )
    save(CHART_NUM, {"data": [arrow], "layout": layout})

Made with Plotly