Responsive Graph Plotter
Scroll to zoom, drag to pan. Try functions like Math.sin(x), x*x, Math.exp(x).
Features:
Interactive Zoom and Pan:
- Use the mouse scroll wheel to zoom in and out.
- Drag the canvas to pan around the graph.
Dynamic Scaling:
- Adjusts the scale dynamically for smooth zooming and panning.
Polished Visuals:
- Gradient background, faint grid lines, and distinct axes for a professional appearance.
Error Handling:
- Alerts the user if the input function is invalid.
Real-Time Feedback:
- The graph updates as you zoom, pan, or change the function.
How to Use:
- Enter a function in the input box (e.g.,
Math.sin(x),x*x,Math.exp(x)). - Click "Plot Graph" to draw the function.
- Use your mouse to zoom (scroll wheel) and pan (dragging).
Let me know if you’d like any further customizations or additional features! 😊
Here’s a list of more function examples you can try in the input field, along with explanations:
Common Mathematical Functions:
Linear Functions:
x: A straight line through the origin.2*x + 5: A straight line with a slope of 2 and a y-intercept of 5.
Quadratic Functions:
x*xorMath.pow(x, 2): A parabola.x*x - 4*x + 3: A shifted quadratic equation.
Cubic Functions:
x*x*xorMath.pow(x, 3): A cubic curve.x*x*x - 2*x*x + x: A custom cubic curve.
Trigonometric Functions (Requires
Math.prefix):Math.sin(x): Sine wave.Math.cos(x): Cosine wave.Math.tan(x): Tangent function (be careful near vertical asymptotes).Math.sin(x) + Math.cos(x): A combination of sine and cosine.
Exponential and Logarithmic Functions:
Math.exp(x): Exponential function .Math.log(x): Natural logarithm (valid only for ).Math.log10(x): Base-10 logarithm.
Absolute Values and Modulo:
Math.abs(x): Absolute value of , which reflects below the x-axis to above it.x % 2: Modulo operation (remainder of ) creates a step-like pattern.
Square Roots:
Math.sqrt(Math.abs(x)): Square root of (works for ).Math.sqrt(x*x + 4): Custom function involving square roots.
Piecewise Functions (Conditional Logic):
(x < 0 ? x*x : x): Parabola for , linear for .(x % 2 === 0 ? Math.sin(x) : Math.cos(x)): Alternates between sine and cosine based on even/odd .
Periodic or Oscillatory Functions:
Math.sin(x) * Math.cos(x): Combined oscillations.Math.sin(2 * x): A sine wave with double frequency.Math.sin(x) + x / 5: Adds a linear trend to a sine wave.
Custom Functions:
Math.pow(Math.sin(x), 3): Cube of the sine function.(Math.sin(x) + Math.cos(x)) * Math.exp(-0.1 * x): A damped sine-cosine combination.
How to Use:
- Enter any of the above functions into the input field.
- Click "Plot Graph", and the tool will evaluate and plot the graph on the canvas.
Example Function Inputs:
Math.sin(x) + Math.log(Math.abs(x) + 1)(Sine wave with logarithmic effect).Math.exp(-0.1 * x) * Math.sin(x)(Damped sine wave).(x > 0 ? x : -x*x)(Absolute value for , parabola for ).Math.abs(Math.sin(x * 2))(Absolute sine wave with double frequency).Math.tan(x) - x(Tangent curve with linear subtraction).
Let me know if you'd like more examples or an explanation of how to create custom mathematical functions!

