pymor.tools.plot

Module Contents

pymor.tools.plot.adaptive(f, a, b, initial_num=10, max_num=2000, angle_tol=2, min_rel_dist=0.01, aspect_ratio=4 / 3, xscale='linear', yscale='linear')[source]

Adaptive sampling of a NumPy array-valued function.

Samples the function such that the piecewise linear interpolation looks “smooth”.

If the function is complex-valued, it is assumed that the magnitude and phase should be plotted.

Parameters

f

The function to sample.

a

The left bound.

b

The right bound.

initial_num

Initial number of linearly spaced sampling points.

max_num

Maximum number of sampling points.

angle_tol

Tolerance for the maximum pointwise angle in degrees away from 180°.

min_rel_dist

Minimum distance between two neighboring points relative to the width of the plot.

aspect_ratio

Ratio between width and height of the plot, used in calculating angles and distances.

xscale

Whether to use linear ('linear') or logarithmic ('log') scale in the x-axis.

yscale

Whether to use linear ('linear') or logarithmic ('log') scale in the y-axis. If the function is complex-valued, yscale only refers to the magnitude (phase is always assumed to be in a linear scale).

Returns

points

A 1D NumPy array of sampled points.

fvals

A NumPy array of function values.