Introduction
Before you trust a model or a derived quantity, it helps to see how it behaves —
where it rises, flattens, peaks, or breaks down — rather than reason about it purely
from an equation. PlotFunction answers "what does this relationship actually look
like across its input range?" by rendering any callable as a clean, presentation-ready
line plot over a chosen interval. Reach for it when you need to expose non-linear
features — plateaus, inflection regions, thresholds — that raw numbers or a symbolic
expression alone can obscure, whether you're validating a model or communicating its
shape to a non-technical audience.
Plotting a function reveals qualitative features — curvature, growth rate changes, local maxima/minima, and boundaries — in ways that raw numerical output cannot. Visual inspection remains a cornerstone of analytic sense-making across disciplines.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
f_of_xrequired | | — | The function of x to plot. |
minimum_x | int | -10 | The minimum value of x to use when plotting the function. |
maximum_x | int | 10 | The maximum value of x to use when plotting the function. |
n | int | 100 | The number of points to use when plotting the function. |
line_color | str | '#3269a8' | The color of the function plot line. |
line_alpha | float | 0.8 | The alpha (transparency) of the function plot line. |
markers | str | 'o' | The marker style to use for the function plot. |
x_axis_variable_name | str | 'x' | The label for the x-axis. |
y_axis_variable_name | str | 'f(x)' | The label for the y-axis. |
title_for_plot | str | 'Function Plot' | The title for the plot. |
subtitle_for_plot | str | 'Shows the function of x' | The subtitle for the plot. |
caption_for_plot | str | None | The caption for the plot. |
data_source_for_plot | str | None | The data source for the plot. |
x_indent | float | -0.127 | The x-indent for the x-axis label. |
title_y_indent | float | 1.125 | The y-indent for the title. |
subtitle_y_indent | float | 1.05 | The y-indent for the subtitle. |
caption_y_indent | float | -0.3 | The y-indent for the caption. |
figure_size | tuple | (8, 5) | The size of the plot figure. |
Returns
None — the function displays a plot.
Example
from analysistoolbox.calculus import PlotFunction
# Plot f(x) = x^2 over the default range
PlotFunction(
f_of_x=lambda x: x**2,
minimum_x=-10,
maximum_x=10,
title_for_plot="Function Plot",
subtitle_for_plot="Shows the function of x",
)