How to make a scatterplot and obtain trendline
Scatterplot Generator
This page outlines how to create a scatter plot. It provides JavaSript app to produce a scatter plot between a single
(independent) variable and up to five
(dependent) variables. If two or more
variables are provided, the option to produce a second Y axis is also provided.
To review about scatter plots, see Chapter 4.5 in Mike’s Biostatistics Book. For more on use — and limitations — of adding second Y-axis, see Chapter 4.6 in Mike’s Biostatistics Book.
Features
Data import and variable selection
- Import data from a CSV file or paste data directly from a spreadsheet.
- Select one independent,
, variable and up to five dependent
variables. - Display multiple datasets on a single graph.
- Optionally assign a second Y variable to an independent vertical axis.
- Automatically omit missing or nonnumeric X–Y pairs from individual series.
Graph customization
- Customize graph titles and axis labels.
- Adjust title, axis-label, tick-label, and legend font sizes.
- Independently select point colors, sizes, and symbols for each
variable. - Optionally connect observations in increasing
order or original data order. - Customize connecting lines and regression curves using solid, dashed, dotted, or dash-dot line styles.
- Adjust line thickness independently for each data series.
Regression and curve fitting
Independently fit any of eleven regression models to each Y variable:
| Model | Equation | Typical application |
|---|---|---|
| Linear | Relationships characterized by a constant rate of change | |
| Linear through the origin | Direct proportionality, calibration curves, and relationships with a theoretically justified zero intercept | |
| Quadratic | Curvilinear relationships, physiological optima, and responses with a single turning point | |
| Cubic | Complex curvilinear relationships with multiple changes in direction | |
| Exponential | Unrestricted population growth, radioactive decay, and first-order degradation | |
| Logarithmic | Diminishing responses and relationships characterized by progressively smaller changes | |
| Power | Allometry, metabolic scaling, and relationships between body size and physiological traits | |
| Three-parameter | Population growth, microbial growth, and sigmoidal responses with a zero lower asymptote | |
| Four-parameter logistic (4PL) | Dose–response relationships and sigmoidal growth with a nonzero baseline | |
| Generalized logistic (Richards’ curve) | Asymmetric sigmoidal growth, organismal development, and microbial growth kinetics | |
| Michaelis–Menten / Monod | Enzyme kinetics, nutrient uptake, and substrate-limited microbial growth |
These models support the investigation of linear and curvilinear relationships, biological scaling, population growth, dose–response relationships, enzyme kinetics, and nutrient-limited microbial growth.
Regression statistics and model evaluation
- Display fitted regression equations and estimated coefficients.
- Report sample size, coefficient of determination (
), adjusted
, residual sum of squares (RSS), and root mean square error (RMSE), as appropriate for the selected model. - Report applicable inferential statistics for linear regression, including slope standard errors, p-values, and 95% confidence intervals.
- Distinguish centered and uncentered
for regression models with and without an estimated intercept. - Identify the fitting scale used for transformed regression models.
- Report nonlinear optimizer convergence and relevant model limitations.
- Compare alternative regression models to assess their suitability for describing observed biological relationships.
Graph and results export
- Export customized graphs as PNG images.
- Export graphs and accompanying regression statistics as PDF documents using the browser’s print-to-PDF capability.
Learning and exploration
- An included simulated yeast growth dataset allows users to explore graph customization, compare growth curves between media treatments, and investigate how different regression models describe biological processes.
All calculations and graph generation take place within the user’s web browser. No statistical software installation or data upload to an external server is required.
Authorship: created by Mike Dohm with ChatGPT, OpenAI’s GPT-6.2, as primary coder.
For bar plots, see How to make a bar chart.
Tips for scatter plots in spreadsheet apps
Here’s a short video stepping you through creating a trend line from a scatterplot in Google Sheets. The video also shows how to log-10-transform the X variable.
Steps to make the plot and obtain trend line
Example data were reported How to obtain slope of the regression1
- Take the time to arrange your data columns so that X (eg, MYA or logMYA) and Y (e.g., genetic Distance) columns next to each other, the column with X variable left of the column with Y variable.
- Highlight the X and Y columns (click and hold on the header for the X column then move to the Y column)
- From menu bar select Insert → Chart
- Select data series by clicking on any data point in the chart
- Check Trendline from the Chart Edit menu at right of your screen
- Label, select Use equation
- Check Show
.
Next, log10-transform the X variable (eg, logMYA)
- Create a new column, label logMYA. For this example, let’s go with column G. I assume, again for this example, that the raw MYA are in column C and the Distance values are in column D.
- In the first open cell,
G2, type the equals sign and the function call=log10(c2), then hit enter. The cell will be updated with the log-base-10 of the value inC2. - Complete the transform for the rest of the values. An easy way to do this is to double-click on the “+” that appears when you hover the mouse over the lower-right part of the cell.
- Now, copy and paste all values from column D to column H.
- Make the new plot and obtain slope and
from the new trendline by repeating steps 3 – 8.