Plot

class zhetapi::Plot

A canvas that be used to graph functions, plot points, etc.

Public Functions

Plot(const std::string& = "Plot #" + std::to_string(def_plot_num))

Name constructor. Initializes the center of the canvas to the origin. The bounds of the x and y axis are both initialized to [-10.5, 10.5]. Defaults the size of the canvas to 800 x 600 pixels.

Parameters

name

the name of the plot (also the plot title). Defaults to “Plot

#{pnum},” where pnum is a static, incremented plot number.

void plot(const Vector<double>&)

Plots a point. Note that the point will not be visible if the coordinate is not in bounds of the axes.

Parameters

coords – the coordinate of the point to be plotted.

void plot(const FunctionType&)

Plots a function. The function is evaluated for each pixel on the width of the canvas (so if the width of the canvas is 800 pixels then there would be 800 distinct evaulateions of the function). The value of the function is appropriately scaled.

Parameters

ftn – the function to be plotted.

void show()

Displays the plot on another thread. Any modifications to the plot will be displayed in real time.

void close()

Closes the plot if it is not already closed.

struct Curve
struct LineGraph
struct Point