Multi-Plot Point Keyword Examples#
This page demonstrates the new point keyword for the multi-plot directive.
Example 1: Using function evaluation with flattened index#
In this example, point: (1, f(2)), 1 adds the point (1, f(2)) to axis 1 (first plot, top-left). The value f(2) is evaluated using the function f(x) = (x-1)² + 1.
Example 2: Using (row, col) format with function evaluation#
In this example, point: (1, h(2)), (2, 1) adds the point (1, h(2)) to the axis at row 2, column 1 (third plot, bottom-left, function h).
Example 3: Multiple points with function evaluation#
This example shows multiple point entries targeting different axes, each evaluating their respective functions.
Example 4: Combining with legacy points keyword#
You can mix the legacy points keyword (per-axis lists) with the new point keyword (axis-targeted).
Example 5: Numeric coordinates (no function calls)#
The point keyword also works with plain numeric coordinates.
HLine Examples#
Example 6: Basic horizontal line#
Full-width horizontal lines at y=2 on axis 1 and y=-1 on axis 3.
Example 7: Horizontal line with x-extent#
Horizontal lines with specified x-ranges: from x=-2 to x=2 at y=1 on axis 1, and from x=0 to x=3 at y=g(1) on row 1, col 2.
Example 8: Combining point and hline#
You can combine point and hline keywords to mark both points and reference lines on specific axes.
VLine Examples#
Example 9: Basic vertical line#
Full-height vertical lines at x=1 on axis 1 and x=-2 on axis 3.
Example 10: Vertical line with y-extent#
Vertical lines with specified y-ranges: from y=-2 to y=2 at x=1 on axis 1, and from y=0 to y=3 at x=sqrt(2) on row 1, col 2.
Example 11: Combining point, hline, and vline#
You can combine point, hline, and vline keywords to create comprehensive reference markers on specific axes.
Using the line keyword#
The line keyword allows you to add reference lines with axis targeting. It supports two forms:
Slope-intercept:
line: a, b, axis_specfor y = a*x + bPoint-slope:
line: a, (x0, y0), axis_specfor a line with slope a through point (x0, y0)
Example 12: Basic line with slope-intercept form#
Adds y = 2x + 1 on axis 1 and y = -x + 2 on axis 3.
Example 13: Line with point-slope form#
Adds line with slope 2 through (1, 3) on axis 1, and slope -1 through (0, 2) on row 2, col 1.
Example 14: Line with function evaluation#
Adds secant line through (1, f(1)) and (4, f(4)) using computed slope on axis 1.
Example 15: Combining all reference markers#
You can combine point, hline, vline, and line keywords for comprehensive visualization.
Using the tangent keyword#
The tangent keyword allows you to add tangent lines to functions at specified points. The derivative is computed automatically using SymPy.
Example 16: Basic tangent line#
Adds tangent to f at x=2 on axis 1, and tangent to g at x=-1 on axis 2.
Example 17: Tangent with (row, col) addressing#
Tangent lines on row 1 col 1 (f at x=1), row 1 col 2 (g at x=π/2), and row 2 col 1 (h at x=0).
Example 18: Tangent with point marker#
Combines tangent lines with point markers at the points of tangency.
Example 19: Multiple tangents on same axis#
Multiple tangent lines can be added to the same axis. This example shows two tangents to f(x) = x³ - 4x at x=-1 and x=1.
Using per-axis limits#
The xmin, xmax, ymin, and ymax keywords allow you to set axis limits either globally or per-axis.
Example 20: Per-axis limits with axis targeting#
Sets custom x and y limits for axis 1 (x from -5 to 5, y from 0 to default), and custom x limits for axis 2 (x from -2π to 2π).
Example 21: Global limits applied to all axes#
Sets the same limits for all axes: x from -3 to 3, y from -5 to 5.
Example 22: Mixing global and per-axis limits#
Sets global x limits (-5 to 5) for all axes, custom ymax for axis 3, and custom y range for axis at row 2, col 1.