Open Tools · Curvewright

Curvewright user guide

The Curvewright user guide: data tables, plot types, linear, polynomial and nonlinear fitting, model expressions, fit statistics and bands, smoothing, export, limitations and how it is verified. To use the tool itself, open Curvewright.

Professional use. Results are for education and preliminary design. They must be checked by a qualified professional, and they are not a substitute for code-compliant design or licensed engineering judgement.

Getting started: a first figure in two minutes

  1. Open the Data tab and press Paste or import data (or copy cells in a spreadsheet and press Ctrl/⌘ V anywhere on the page). A preview shows how the text was read: delimiter, header row, decimal separator.
  2. Press Import table. The first numeric column becomes x and the next ones are plotted against it.
  3. Open the Fit tab, press New fit, choose a model (a polynomial, a library curve, or your own expression) and press Fit (Ctrl/⌘ Enter). With Live on, the fit follows every change to the data or settings.
  4. In the results, press + confidence band to draw the curve with its band on the figure, or Residual panel to add a second panel with the residuals.
  5. Use the Format panel on the right for axis labels, log scales, themes and sizes, and Export (top right) for SVG, PDF or PNG at the size of your page or slide.
  6. Save writes a .curvewright.json file. Your work is also autosaved in this browser using IndexedDB when storage is available. Use Save for a portable backup.

Prefer to start from something concrete? Examples opens eight documents: two use public reference datasets, the others are synthetic and labelled as such.

The workspace

The window has three areas.

AreaContents
LeftData (tables and a spreadsheet-style grid), Fit (models, options and results), Smooth · Stats (smoothing, derivatives, interpolation, descriptive statistics, histograms and box plots).
CentreThe figure exactly as it will be exported, with a toolbar for resetting the view and placing annotations. Move the pointer over a panel to read data coordinates; drag to zoom into a rectangle; double-click to reset.
RightFormat: Figure (size, theme, layout), Panel (titles, axes, legend), Series (what is plotted and how) and Notes (annotations).

Ctrl/⌘ K opens the command palette, which lists every action by name. On a phone the three areas become four tabs at the bottom (Data, Fit, Plot, Format).

Data tables

Importing and pasting

Curvewright reads comma-, tab-, semicolon- and whitespace-separated text. It detects the delimiter, whether the first row is a header, and whether numbers use decimal commas. Lines starting with #, // or % are comments. These tokens mean a missing value: empty, NA, N/A, NaN, null, -, --, ---. A column is numeric when every cell is a number or missing, otherwise it is a text column (useful for categories in bar and box plots).

Imports run in a background worker, with limits of 1,000,000 rows, 64 columns, 32 Mi characters and a conservative 400 MiB memory estimate. Large combinations of rows and columns are refused even below the individual limits. Quoted CSV and TSV cells may contain line breaks and escaped quotes. When a row cap is reached, the remaining input is not parsed; comments are counted only in the portion read.

Editing

The grid works from the keyboard like a spreadsheet: arrows move, Shift extends the selection, Enter or F2 edits, typing starts an edit, Delete clears, Ctrl/⌘ C and V copy and paste blocks (pasting into the grid extends it). Numeric columns accept numbers or empty cells; anything else is refused with a message.

Column tools: rename, sort, add a column from a formula (for example ln_y = log(y) or y/y0 where each name is another numeric column and i is the row number), insert and delete rows, drop empty rows. Renaming a column keeps the series and fits that use it.

Table size

Every table is kept in memory in your browser. IndexedDB autosave handles larger projects subject to available storage and browser quota. A storage warning means you should use Save to keep your work. The hard limits are 24 tables per document and 1,000,000 rows per column.

Plot types and layout

TypeDataNotes
Scatterx and y columnsMarkers; optional x and y error bars. Up to 40,000 markers are plotted; very dense data are thinned for display only.
Line, line with points, stepx and y columnsFor monotone x, long lines keep the minimum and maximum of every pixel column. Nonmonotone x uses stride sampling and warns that extrema may be omitted.
Barcategory column (text or numbers) and ySeveral bar series are grouped side by side. Error bars are optional.
Histogramone columnBin rules: Sturges, square root, Scott, Freedman–Diaconis, fixed count or width; counts or density.
Boxone column, optionally grouped by a category columnQuartiles by linear interpolation; whiskers reach the furthest points within 1.5 × IQR (adjustable); outliers and means are marked.
Fit curve, residualsa saved fitCurve with optional confidence and prediction bands; residuals raw, weighted or studentised.

Axes. Each axis can be linear or logarithmic (log-log and semi-log are just the two axes' settings), reversed, limited, and given major and minor grids. Points that are not positive are skipped on a log axis and counted in the note under the figure. A second y axis on the right is switched on in the Panel tab; assign series to it in the Series tab.

Multi-panel figures. Add panels in the Panel tab; the grid grows automatically and can be set in Figure (up to 4 × 4, 12 panels). Panel labels (a), (b), … are optional.

Error bars come from a column (symmetric), two columns (asymmetric), a fixed value or a percentage.

Annotations are text, horizontal and vertical reference lines, arrows and shaded regions in data coordinates. Place them with the toolbar tools or type exact coordinates in the Notes tab.

Label markup. In axis labels, titles, legends and annotations: x^2 or x^{-1} for superscripts, x_i or x_{max} for subscripts, and \mu, \alpha, \Delta, \pm, \times, \deg for symbols.

Themes. Journal (print) and Grayscale (print-safe) vary markers and dash patterns as well as colour, so series stay distinguishable in black and white. Clean, Presentation and Dark are for screens and slides.

Fitting curves

Model types

  • Polynomial: degree 1 to 12, optionally through the origin. Solved by Householder QR in a centred and scaled variable (never by normal equations); coefficients and their covariance are converted back to powers of x.
  • Library: exponential, exponential decay with offset, exponential rise, power law, Gaussian peak, Lorentzian peak, logistic, four-parameter logistic (dose-response), Michaelis–Menten, sinusoid, and double exponential decay. Each has data-driven starting values; Fill start values from the data shows them.
  • Your own: any expression of x with named parameters, for example a*exp(-b*x) + c. Parameters are every name other than x, the constants and the functions. See Writing model expressions.

Nonlinear fitting method

Curvewright uses the Levenberg–Marquardt method. The Jacobian comes from symbolic derivatives of your expression (numerical differences are used only for a function without a derivative rule, which the results panel reports). Each step solves the damped least-squares problem through the QR factorisation of the Jacobian, so the squared condition number of the normal equations never appears. Damping follows the ratio of actual to predicted reduction, columns are scaled by the running maximum of their norms, bounds are applied by projection with the active set held fixed, and fixed parameters are removed from the problem. A fit stops on a vanishing scaled gradient, a vanishing step or cost change (relative 1e-15), or the iteration limit; the message says which.

Random restarts (0 to 50) re-run the fit from seeded log-normal perturbations of the starting values and keep the best converged result. Use them when the cost surface has several minima or the model is nearly unidentifiable.

Weights and uncertainties

Choose 1/σ² from an uncertainty column, a weight column, 1/|y| or 1/y². With uncertainties you also choose how they are read:

  • Relative σ (default): only the ratios matter; the covariance is scaled by the residual variance and intervals use Student's t.
  • Absolute σ: the numbers are true standard deviations; the covariance is not rescaled, intervals use the normal distribution, and the reduced χ² and its p-value tell you whether the uncertainties are plausible.

Size and cancelling

Fits run in a background worker. Up to 100,000 points are fitted interactively; the hard limits are 2,000,000 points and an estimated working memory of 400 MiB, beyond which Curvewright says so instead of risking the browser tab. Cancel calculations (or Esc) stops pending fitting, processing, parsing, rendering and export by terminating the worker. Pending results are discarded when the document is edited, undone or replaced. The Verify view has its own Cancel control. Calculations require Web Worker support; editing and Save/Open remain available when workers cannot start. RMSE is the unweighted square root of the mean squared residual, including residual bias.

Fit statistics and bands

With n points, k fitted parameters, weights w, residuals e = y − ŷ and S = Σ w e² (the weighted residual sum of squares):

QuantityDefinition
Residual standard deviations = √(S / (n − k))
Parameter covariancerelative σ: s² (JᵀWJ)⁻¹; absolute σ: (JᵀWJ)⁻¹, with J the Jacobian at the solution
Standard error, t, pSEᵢ = √Cᵢᵢ; t = estimate / SE; two-sided p from Student's t with n − k degrees of freedom (normal for absolute σ)
Confidence intervalestimate ± t(1 − α/2, n − k) · SE for relative σ; normal quantile for absolute σ
R²1 − S / Σ w (y − ȳw)²; uncentred (Σ w y² in the denominator) for models without a constant term
Adjusted R²1 − (S / (n − k)) / (TSS / (n − 1)); denominator uses TSS / n for uncentred models
AIC, AICc, BICn ln(S / n) + 2k; AIC + 2k(k + 1)/(n − k − 1); n ln(S / n) + k ln n. Compare models fitted to the same data and weights; the absolute values have no meaning.
F statisticlinear models: ((TSS − S)/(k − 1)) / (S/(n − k)) with its p-value; use k instead of k − 1 for models without a constant term
Durbin–WatsonΣ(eₜ − eₜ₋₁)² / Σ eₜ² on the residuals in row order; about 2 for uncorrelated residuals
Reduced χ²S / (n − k) (near 1 when absolute uncertainties are right)

Bands. The confidence band is the uncertainty of the fitted curve, ŷ ± q √(gᵀ C g), with g the gradient of the model with respect to its parameters at each x (the delta method). As for parameter intervals, q is a Student t quantile for relative σ and a normal quantile for absolute σ. The prediction band adds the variance of one new observation, s²/w₀ for relative σ or 1/w₀ for absolute σ. The bands are linearised, so for strongly nonlinear models they are approximate. For fits with parameters at a bound or held fixed, only the free parameters contribute.

Checks on your fit. Each result is followed by a short list of internal consistency checks: the fitted values and the sum of squares recompute from the parameters, the residuals satisfy the first-order conditions, the covariance is symmetric and positive on its diagonal, correlations lie in [−1, 1], and so on.

Writing model expressions

Expressions are parsed by a small built-in parser and evaluated by compiled closures. Nothing you type is ever run as code: the only things an expression can contain are numbers, x, constants, parameter names and the functions below.

ElementSyntax
Operators+ - * / ^ (also **); ^ binds tighter than unary minus and is right associative, so -x^2 is −(x²) and 2^3^2 is 512
Numbers3, .5, 1e-3, 2.5E4; implicit multiplication after a number: 2x, 3(x+1)
Constantspi, e
Functionsexp ln log log10 log2 sqrt cbrt abs sign sin cos tan asin acos atan atan2 sinh cosh tanh erf erfc floor ceil round step min max pow hypot (log is the natural logarithm)
Prefixan optional y = or f(x) = is ignored

Limits: 2,000 characters, nesting depth 64, 24 parameters. Names such as constructor and anything starting with two underscores are refused as parameter names. Errors point to the position of the problem.

Examples:

a*exp(-b*x) + c
A*sin(2*pi*f*x + phi) + C
(b1 + b2*x + b3*x^2) / (1 + b4*x + b5*x^2)
b1 - b2*x - atan(b3/(x - b4))/pi

Give the parameters sensible start values: Levenberg–Marquardt finds a nearby minimum, not necessarily the best one. Bounds (for example a rate that must be positive) and Fix (hold a parameter at its start value) are in the parameter table.

Smoothing, derivatives and interpolation

Open Smooth · Stats.

  • Moving average: a centred average of an odd number of points. Near the ends the window can shrink (default), repeat the end value or mirror about the end point.
  • Savitzky–Golay: in each window of 2m + 1 points a polynomial of the chosen order is fitted by least squares and its value (or derivative) at the centre is the output. The weights are computed from the least-squares problem itself, not looked up. They need evenly spaced x, and Curvewright says so if the spacing is uneven (interpolate onto an even grid first). The ends use a polynomial fitted to the first and last window.
  • Derivative: first to third derivative from the same filter, in units of y per unit x.
  • Interpolate: linear, natural cubic spline or monotone cubic (PCHIP) on an even grid of up to 100,000 points; repeated x values are averaged. A natural spline can overshoot between points, PCHIP cannot. The trapezoid area under the data is reported.
  • Statistics: count, mean, standard deviation (n − 1), standard error, median, quartiles (linear interpolation), minimum and maximum; one-click histogram and box plot.

Smoothing and derivatives add a column to the table and plot it; interpolation creates a new table.

Exporting figures

The figure size is set in millimetres (presets for single column 89 mm, 1.5 column 120 mm, double column 183 mm, square, slide and half page, or any custom size). Text sizes and line widths are in points, so the figure keeps the type size you chose when it is placed at its real size.

FormatNotes
SVGVector, at the physical size, with the title and a description. Text is live text in Helvetica or Arial.
PDFOne page, vector, exact figure size; standard Helvetica, Helvetica-Bold and Symbol fonts (not embedded). Latin-1 characters and Greek letters work; other symbols are replaced by "?" and counted.
PNGRaster at 96 to 1200 dpi with the resolution written into the file. If the browser's maximum canvas size would be exceeded, the resolution is reduced and the dialog says so.

Each figure export carries a visible "Made with Curvewright · simulations4all.com" footer and the professional-use notice, with copyright and terms in its metadata. Text reports and CSV header comments include the same notices. The fit report (parameters, intervals, statistics, correlation matrix) downloads as text, and parameters and residuals as CSV.

Files, autosave and privacy

A Curvewright file is JSON with "format": "curvewright-document" and a version number. It stores the tables, the saved fit settings and the figure specification. Results are recomputed on opening, never stored. The file also carries a copyright and terms notice field.

Autosave keeps the current document in this browser's IndexedDB project storage. Available quota is checked when the browser exposes it. Quota rejection or private-mode restrictions leave the previous autosave intact and show a warning; use Save for a portable backup. Older local-storage autosaves are migrated after a successful save. Nothing is sent anywhere: no analytics, no accounts, no server calculation. The only network request the tool makes is the licence-token exchange with simulations4all.com that lets the calculations run; downloaded copies of the page do not work. Editing data, opening and saving files and reading this Guide work without it, and cached tokens keep calculations available for up to 24 hours offline.

Keyboard shortcuts

KeysAction
Ctrl/⌘ KCommand palette
Ctrl/⌘ EnterRun the current fit
EscClose a dialog, stop placing an annotation, cancel pending calculations
Ctrl/⌘ Z, Ctrl/⌘ Shift ZUndo, redo
Ctrl/⌘ S, Ctrl/⌘ OSave, open
Ctrl/⌘ I, Ctrl/⌘ EImport data, export figure
Alt 1, Alt 2, Alt 3Data, Fit, Smooth · Stats
Alt FFocus the figure
+ − arrows 0 (figure focused)Zoom, pan, reset
Grid: arrows, Tab, Enter, F2, DeleteMove, edit, clear
?Show the shortcut list

Dialogs move focus inside when opened. Tab and Shift+Tab stay inside the dialog; Esc closes it and returns focus to the control that opened it. The surrounding page is inactive until the dialog closes.

Limitations: what Curvewright does not do

  • One independent variable. Fits use x and y only; there is no multi-variable regression or surface fitting, and no fitting with errors in x (orthogonal regression). X error bars are drawn but not used by the fit.
  • No global fitting of several datasets with shared parameters, no implicit models, no differential-equation models, no nonparametric smoothers such as LOESS, and no peak-deconvolution workflow with automatic peak finding.
  • Parameter intervals are Wald intervals from the linearised covariance. They can be poor for strongly nonlinear models, and when a parameter sits at a bound the standard errors ignore the bound. Profile-likelihood and bootstrap intervals are not provided.
  • Prediction bands assume independent residuals with constant variance (after weighting).
  • Plots: 2-D Cartesian only (no polar, ternary, 3-D, contour, heat-map or time-axis charts); the display of very large scatter plots is thinned.
  • PDF export uses the standard fonts, so symbols outside Latin-1 and Greek are not available in PDF (SVG and PNG keep them).
  • Interactive fitting is designed for up to 100,000 points; above 2,000,000 points, or when the estimated memory exceeds 400 MiB, a fit is refused.
  • Import reads delimited text only; there is no spreadsheet-file or instrument-file import.
  • Statistical tests other than the regression F test, the t tests on parameters and the χ² goodness-of-fit are not included.

Compared with other tools

Curvewright covers the core of scientific plotting and curve fitting: tabular data entry, the common 2-D chart types, linear, polynomial and nonlinear least squares with weights, bounds and parameter statistics, smoothing, interpolation and publication-size vector export, all in a web page with no installation and no data upload.

Desktop analysis and graphing packages go further in several areas: batch processing and scripting, additional plot types, spreadsheet and instrument file formats, global fitting, peak analysis, more statistical tests and project management. If your work needs those, use a full package; Curvewright's fit statistics and file formats are documented so you can cross-check results elsewhere.

How we verify Curvewright

Curvewright is checked with published reference datasets, independent numerical references, hand calculations and self-consistency properties. These checks cover representative cases rather than every possible input. The checks are in the tool: open Verify to run all 272 of them in your own browser and see, for each, what is compared, the reference, the computed value, the difference, the tolerance and PASS or FAIL. The same case list is run by the project's automated tests, so what you see is what is checked before release.

GroupCasesReference
NIST linear regression22Certified values, public NIST datasets (Norris, Pontius, no-intercept sets, Filip, Longley, Wampler 1–5)
NIST nonlinear regression77Certified values and starting points, public NIST datasets (26 problems, both starts)
Closed forms33Textbook formulas, exact rational arithmetic, noiseless recovery of known parameters
Cross-checks (independent libraries)35Values recorded from established open-source numerical libraries on identical data
Distributions21Closed-form special cases and recorded library values
Expression parser12Hand-evaluated expressions, derivative identities and hostile-input rejection
Smoothing31Exact rational filter coefficients, polynomial reproduction, recorded filter output
Interpolation11Recorded interpolation and integration values, exact reproduction properties
Statistics and binning8Recorded values for quantiles, histogram rules and box statistics
Tables7Hand-read text layouts and round trips
Plotting and export15Unit conversions, tick rules and structural checks of SVG and PDF output

Where a certified value exists (the public NIST Statistical Reference Datasets for linear and nonlinear regression), Curvewright's results are compared at the tolerance stated for each case. Reference values from numerical libraries are recorded as literals, so no library is needed at run time. A case that cannot be sourced is listed as pending and never counted as a pass.

Some very hard starting points in the public nonlinear datasets cannot be solved by this method from the first (far) start; those cases use random restarts, and one is documented as a deliberate non-convergence check. The Verify page also runs the per-fit checks on the document saved in your browser.

Troubleshooting

Message or symptomWhat to do
"This tool runs only on simulations4all.com"Calculations need the licence token. Reconnect; editing and saving still work.
The fit does not convergeGive better start values (use Fill start values from the data), add bounds, increase Max iterations, or try random restarts. Check the model is not over-parameterised: a rank-deficient Jacobian is reported.
"'tau' is reserved" and similarOnly x, pi, e and function names are reserved. Rename the parameter.
"The design is rank deficient"A polynomial has more coefficients than distinct x values, or columns are collinear. Lower the degree.
Wild standard errorsParameters are strongly correlated or the model is nearly non-identifiable; look at the correlation matrix.
Savitzky–Golay refusesThe x spacing is uneven. Interpolate onto an even grid, or use the moving average.
Log axis shows fewer pointsNon-positive values cannot be drawn on a log axis; the note under the figure counts them.
PNG is lower resolution than requestedThe browser's canvas limit applies; the dialog states the resolution used. Use SVG or PDF for full resolution.
Autosave unavailableThe browser blocks local storage (private mode) or the document is large. Use Save.

Professional-use notice

For education and preliminary design. Results must be checked by a qualified professional and are not a substitute for code-compliant design or licensed engineering judgement. Fitted parameters, intervals and bands depend on the model and data you supply, and no certification or regulatory acceptance is claimed.