Mathematica package to constrain plot evaluation time.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE
README.md
TimeConstrainedPlot.m
TimeConstrainedPlot.nb

README.md

TimeConstrainedPlot

Mathematica package to constrain plot evaluation time.

Installation

Download TimeConstrainedPlot.m and put it in the directory given by FileNameJoin[{$UserBaseDirectory, "Applications"}]

Examples

Plot a slow function:

<<<TimeConstrainedPlot`

slowSin[x_] := (Pause[RandomReal[0.01]]; Sin[x])

TimeConstrainedPlot[
    Plot3D[slowSin[x] Cos[y], {x, 0, 10}, {y, 0, 10}],
    1]

Plot3D example

Options

All options provided to the original plot function that are valid for the corresponding List*Plot will be kept. To provide more options put them in the third argument

Scope

Constrainable plot functions:

{DensityPlot, DiscretePlot,
 LogLinearPlot, LogLogPlot, LogPlot,
 ParametricPlot, Plot, Plot3D, PolarPlot}

Preserves sample refinement on a per-function basis:

TimeConstrainedPlot[
Plot[{Abs[x], Abs[x - 1/2]}, {x, -1, 1}]
, 1, Joined -> False]

sampling

Possible Issues

There might not be enough time to cover the entire plot range:

TimeConstrainedPlot[Plot[slowSin[x], {x, 0, 10}], 1]

range issue

With lower PlotPoints there is enough time to cover the range and the adaptive algorithm can start refining:

TimeConstrainedPlot[Plot[slowSin[x], {x, 0, 10}, PlotPoints -> 5], 1]

workaround


Only the refinement is time-constrained, the time to create and display the List*Plot is not restricted.