This is the documentation page for Module:ColinTheCat/Plotter
clamp 01
Arguments
| Argument | Description | Example | Default |
|---|---|---|---|
| Plots | Plots as JSON | See #Example | |
| From | Lowest x,y to plot | -pi/2,0 |
0,0
|
| To | Highest x,y to plot | 10^2,2 |
|
| Origin | X/Y Axis origin | 0.5,0.5 |
0,0
|
| GridStep | Coordinate grid step size | pi/2,1 |
1,1
|
| Inline | Display the plot inline instead of floating | true |
(absent) |
| Axis label (not implemented) | |||
| LabelStepX | Label for grid X-axis increments | format("%sπ", dfrac(x/pi, 1)) |
format("%d", x)
|
| LabelStepY | Label for grid X-axis increments | format("%.1f", y) |
format("%d", x)
|
| ColorX | X-axis color | #44f |
#f44
|
| ColorY | Y-axis color | #0f4 |
#0f0
|
Underlined Arguments are required.
Available Functions and Constants in Expressions
printf(format, ...args)
See Lua string.format.dfrac(number, is_factor)
Formats a float as a fraction, if possible. If it is a factor, then the number 1 or -1 will only produce its sign as an output, useful when formatting as a factor of pi, for example. See #Example below.sin,floor,abs,...
Any constant or function from the Lua math library can be used directly (without themath.prefix).
Example
{{#invoke:ColinTheCat/Plotter|Plot2D
|From=-0.2, -1.2
|To=2 * pi + 0.2, 1.2
|GridStep=0.5 * pi, 1
|LabelStepX=format("%sπ", dfrac(x/pi, 1))
|Plots=
[
{"Type": "function", "Function": "sin(x)", "Samples": 100, "Label": "sin"},
{"Type": "function", "Function": "cos(x)", "Samples": 100, "Label": "cos"},
{"Type": "function", "Function": "tan(x)", "Samples": 35, "Label": "tan", "Ranges": [
{"To": "(0.5-0.2)*pi"},
{"From": "(0.5+0.2)*pi", "To": "(1.5-0.2)*pi"},
{"From": "(1.5+0.2)*pi"}
]}
]
}}
sincostan