Skip to content

simonschmidt/TimeConstrainedPlot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Mathematica package to constrain plot evaluation time.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published