# Graph Plotter

> Plot up to three functions with a safe expression parser and explore values.

Graph Plotter is a browser-based function plotter in MyBox. It parses mathematical expressions locally, draws up to three curves on a canvas, and includes a values table for the active expression. It needs no account, API key, or network request after the page loads.

## What you can do

- Enter up to three expressions of `x`, each with its own color, visibility toggle, and inline error.
- Switch between radians and degrees for trigonometric functions.
- Zoom with the mouse wheel, buttons, or a pinch gesture; drag or use the arrow keys to pan.
- Reset the view to the default x range of -10 to 10.
- Hover over the graph to trace the nearest visible curve at that x value.
- Read the values table for the active expression across the current x range.

## Expression syntax

- Operators: `+`, `-`, `*`, `/`, and `^` for powers. Parentheses and unary minus are supported.
- Multiplication must be explicit: use `2*x`, not `2x`.
- Functions: `sin`, `cos`, `tan`, `asin`, `acos`, `atan`, `sqrt`, `abs`, `log`, `ln`, and `exp`.
- Constants: `pi` and `e`. The only variable is `x`.
- Expressions are limited to 200 characters and cannot access properties or run code.

## Angle mode

In radians mode, trigonometric functions use radians. In degrees mode, `sin`, `cos`, and `tan` interpret their input as degrees, and `asin`, `acos`, and `atan` return degrees. For example, `sin(90)` is `1` in degrees mode.

## Graph controls

- Mouse: drag to pan, scroll to zoom, and move the pointer to trace values.
- Touch: drag with one finger to pan and pinch with two fingers to zoom.
- Keyboard: focus the graph, use arrow keys to pan, `+` or `-` to zoom, and `0` or Home to reset.
- The zoom in, zoom out, and reset buttons provide the same view controls without a gesture.

## Values table

The table below the graph shows nine sampled x and y values for the active expression. It follows the current view range and is an accessible alternative to reading the canvas.

## Privacy and safety

- Expressions are parsed and evaluated in this browser. The page never sends expression text to analytics, a server, or another service.
- Analytics are limited to aggregate actions such as adding a function, zooming, and resetting the view.
- The parser does not use `eval`, `new Function`, or an external math library. Unknown functions, property access, and code-like input are rejected.
- No account, sign-in, API key, backend route, or external content is required.
- The graph view is not saved. Reloading the page starts from the default view and example expression.

## Notes

- The canvas samples each curve and breaks the path at undefined points, such as `1/x` at x = 0.
- Values are floating-point approximations, so very large or very small results may be shown in scientific notation.
- This Markdown twin is static. Open the interactive page to edit expressions and explore the graph.

## Related

- [Graph Plotter](https://mybox.id/graph-plotter)
- [Math Practice](https://mybox.id/math-practice)
- [Solar System](https://mybox.id/solar-system)
- [Typing Tutor](https://mybox.id/typing)
- [Periodic Table](https://mybox.id/periodic-table)
- [Apps](https://mybox.id/apps): Every app with a short description.
