Share with others: Link to this plot.
Controls and documentation
The plot is updated each time you change the JavaScript code. Click and drag the plot to pan around. Use the mousewheel to zoom in or out.
You can display a function in the plot by calling plot(args...)
.
It takes its parameters in any order. What an argument does depends on its type:
function
: Plots the graph of that function.
It is called for each x value and has to return the corresponding y value.
string
(e.g. "red"
or "hsla(210, 50%, 50%, 0.25)"
):
The graph will be drawn in that color (default "blue"
).
number
(e.g. 2
): It is used as the line width in pixels for the graph (default 1
).
array
(e.g. [10, 5]
): It is used to dash lines of the graph.
The elements specify distances to alternately draw a line and a gap in pixels.
See setLineDash.