How to plot a large CSV file with millions of rows
By MegaRows · Published · 9 min read
A data logger, a test rig or a busy web server can write millions of rows in an afternoon. Then you try to chart them: Excel stops at 1,048,576 rows, a Python plot takes a minute to appear, and an online plotter wants you to upload a 2 GB file. This guide explains why big files are hard to plot, why some charts hide the very spikes you are looking for, and which options work today.
Why big CSV files are hard to plot
- Spreadsheet row limits. An Excel worksheet holds 1,048,576 rows and Google Sheets 10 million cells per spreadsheet. A chart can only use rows that made it onto the sheet, so the rest of the file never appears.
- Drawing cost. Every point becomes a line segment that has to be drawn again on every zoom, pan and resize. SVG-based chart libraries put every point into the page as path data or as separate elements; canvas is faster, but tens of millions of segments per redraw still take seconds. In our tests, gnuplot needed 30 to 60 seconds to draw 5 million points into a PNG.
- Memory. A CSV is text. Parsed into one object per row, as many tools do, it can take several times the file size in memory, and a browser tab runs out long before your computer does.
- Pixels. Five million rows on a chart 1,500 pixels wide means more than 3,000 points per pixel column. Most of them are painted on top of each other.
Why spikes vanish when data is thinned out
Since the screen can’t show every point anyway, many tools and scripts quietly draw fewer of them. How they choose matters. The obvious shortcut, keeping every Nth row, is blind: a spike shorter than N rows disappears unless it happens to land on a kept row, noise looks calmer than it is, and regular signals can turn into slow waves that aren’t there. Averaging each block of rows has the same problem, because it flattens peaks.
In our test with 5 million rows and a spike just three rows long, plotting every 2,500th row produced a clean wave with no spike at all. The same file reduced to each block’s lowest and highest value showed the spike at full height. Before you trust a tool with big files, try it on data with a known short spike and check that it still shows when you are fully zoomed out.
Option 1: The MegaRows plotter
The MegaRows plotter opens CSV, TSV, TXT, Excel (.xlsx), JSON and MATLAB .mat files with millions of rows in your browser and draws them as zoomable line charts. A 10-million-row file opens in about three seconds on a recent laptop. Short peaks stay visible however far you zoom out, and when you zoom in, the full detail for that range reloads instantly. The file never leaves your device.
- Open your file. Open the plotter and click “Choose a file”, or drop a CSV, Excel, TXT, JSON or MATLAB .mat file onto it. Separators, decimal commas, dates and header lines are detected for you, and the file is read on your device.
- Pick the columns. The plotter suggests an x column, such as a time column, and a first series. Add up to eight series, and move any of them to the right-hand y-axis when their units differ.
- Zoom, check and export. Drag across the chart to zoom: the full detail for that range reloads straight away. Double-click to reset, open a column’s statistics, and export the chart as a PNG.
The statistics panel shows the count, missing values, minimum, maximum, mean and standard deviation of a column, calculated from every row.
Pros: nothing to install; private; millions of rows; spikes stay visible; zoom reloads full detail; two y-axes and PNG export.
Cons: line charts only for now; old .xls workbooks must be saved as .xlsx first; limited by your device’s memory.
Option 2: Excel
Excel is fine for charts of a few thousand points and great for polishing a final chart. For big files it runs into two walls. The data must sit on a worksheet, which stops at 1,048,576 rows. And although Microsoft lists the points per chart series as limited only by available memory (with up to 255 series per chart), charts with hundreds of thousands of points get slow to draw, resize and edit. Excel also draws every point, so a dense series turns into a solid block.
The workaround is to chart a summary. A PivotChart built from the Data Model can show one value per minute or hour; include the minimum and maximum alongside the average, or spikes vanish. Or reduce the file first with DuckDB or Python, as shown below, and chart the result.
Pros: familiar; flexible formatting; good for presenting reduced data.
Cons: row limit; sluggish with dense charts; no built-in downsampling.
Option 3: Python with matplotlib or Plotly
matplotlib can draw a few million points, but slowly, and very long line plots sometimes fail with an “Exceeded cell block limit” error (raising the agg.path.chunksize setting helps). Reducing the data first is much faster and looks practically the same. Keeping the lowest and highest value of each of 2,000 blocks means no spike can slip through the gaps. In a few lines of NumPy:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv("big.csv", usecols=["time", "value"]).dropna()
x = df["time"].to_numpy()
y = df["value"].to_numpy()
def min_max_downsample(x, y, buckets=2000):
"""Keep the lowest and highest point of each bucket, in order."""
if len(y) <= 2 * buckets:
return x, y
edges = np.linspace(0, len(y), buckets + 1).astype(int)
keep = []
for start, end in zip(edges[:-1], edges[1:]):
lo = start + np.argmin(y[start:end])
hi = start + np.argmax(y[start:end])
keep.extend(sorted({lo, hi}))
return x[keep], y[keep]
xs, ys = min_max_downsample(x, y)
plt.figure(figsize=(12, 4))
plt.plot(xs, ys, linewidth=0.8)
plt.xlabel("time")
plt.ylabel("value")
plt.savefig("plot.png", dpi=150)On our 5-million-row test file this kept 4,000 points, including the three-row spike, and the whole script ran in under two seconds. Drop rows with missing values first, as above: argmin and argmax return the position of the first NaN instead of the real extreme.
Plotly gives interactive charts in a browser or notebook. Its WebGL traces (go.Scattergl) handle far more points than the default SVG ones, and the open-source plotly-resampler package downsamples again as you zoom. Saved as HTML, a chart contains every point it draws, so reduce the data before sharing it.
Pros: free; full control; easy to repeat for many files.
Cons: needs Python and code; static matplotlib images don’t reload detail when you zoom.
Option 4: gnuplot
gnuplot is a free command-line plotting program that reads CSV files directly:
set datafile separator ","
set key autotitle columnhead
set terminal pngcairo size 1600,500
set output "plot.png"
plot "big.csv" using 1:3 with linesIt draws every point it reads, so the result is accurate, but slow for big files: our 5-million-row file took 30 to 60 seconds. Its every option (plot "big.csv" every 100 using 1:3 with lines) is fast because it is the every-Nth-point method, with the same blind spots. The interactive windows let you zoom with the mouse, but each redraw goes through all the points again.
Pros: free; scriptable; publication-quality output; reads big files.
Cons: its own syntax to learn; no built-in min/max downsampling; slow redraws.
Option 5: DuckDB and any charting tool
DuckDB is a free, single-file database that queries CSV files directly. Let it shrink the data, then chart the small result in anything, even Excel:
COPY (
SELECT date_trunc('minute', ts) AS minute,
min(value) AS low,
max(value) AS high,
avg(value) AS mean
FROM 'big.csv'
GROUP BY minute
ORDER BY minute
) TO 'per_minute.csv' (HEADER, DELIMITER ',');On our 5-million-row test file the query took well under a second and returned 834 rows with each minute’s low, high and mean. Plot low and high as two lines and the spike is still there. Use time_bucket for other intervals, or floor(x / 10) for a numeric x column.
Pros: very fast; copes with files larger than memory; the result fits easily in Excel.
Cons: needs SQL; fixed bucket size, so zooming in means running the query again.
Option 6: Online CSV plotters
Plenty of websites plot a CSV for free. Before you drop a big or sensitive file into one, check three things: whether it uploads the file (most do; watch the Network tab of your browser’s developer tools), what size or row cap it has (often a few megabytes), and how it reduces the data (many sample every Nth point or simply stop at a limit).
Pros: nothing to install; quick for small files.
Cons: uploads are slow and a privacy risk; size caps; spikes can vanish.
Which option should you choose?
| Option | Millions of rows | Spikes kept | Zoom to full detail | Install |
|---|---|---|---|---|
| MegaRows plotter | Yes | Yes | Yes | None |
| Excel | No | Yes, if it fits | Manual | Excel |
| matplotlib with min/max | Yes | Yes | Re-run | Python |
| gnuplot | Slowly | Yes | Slow redraws | gnuplot |
| DuckDB summary | Yes | With min and max | Re-run | DuckDB |
| Typical online plotter | Often capped | Varies | Varies | None (uploads) |
To explore a file and find the interesting part, use a tool that zooms to full detail. For a report, reduce the data with min and max per bucket and chart the result wherever you like.
Get notified when the full viewer launches.
Scroll, sort and search millions of rows right in your browser. Leave your email and we will tell you when it is ready. No spam.
Frequently asked questions
How do I plot a CSV file with millions of rows?
Use a tool that reduces the data to what the screen can show without dropping extremes, and reloads detail when you zoom. The MegaRows plotter does this in your browser. In Python, keep the minimum and maximum of each bucket before plotting, or let DuckDB summarise the file and chart the result. Spreadsheets stop at around a million rows.
Why can’t Excel chart my whole CSV file?
A chart can only use rows that are on a worksheet, and a worksheet holds 1,048,576 rows, so anything beyond that is never loaded. Microsoft lists the number of points per chart series as limited by available memory, but charts with hundreds of thousands of points become slow to draw and edit long before that.
Why do spikes disappear when I plot a big file?
Usually because the data was thinned out. Plotting every Nth row, which many tools and scripts do to stay fast, skips anything shorter than N rows unless it lands on a kept row, and averaging blocks of rows flattens peaks. In our test, every 2,500th row of a 5-million-row file showed no trace of a three-row spike. Keep each block’s minimum and maximum instead, or use a tool that keeps peaks visible.
Does thinning out the points change my data?
No. It only affects what is drawn; the file itself is not changed. A chart drawn from thinned data can still mislead you, so check the extremes separately. In the MegaRows plotter, the statistics panel shows each column’s minimum, maximum and mean calculated from every row.
Can I plot a CSV file online without uploading it?
Yes, with a tool that processes the file in your browser. The MegaRows plotter reads the file on your device and sends nothing to a server; you can confirm this in the Network tab of your browser’s developer tools. Many other online plotters upload the file first.
How big a file can the MegaRows plotter open?
There is no fixed limit on rows or file size: the practical limit is your device’s memory. A 10-million-row CSV opens in about three seconds on a recent laptop, and zooming in and out stays smooth.
Can I plot Excel, JSON or MATLAB files?
Yes. Besides CSV, TSV and TXT, the MegaRows plotter opens Excel .xlsx and .xlsm workbooks, JSON and JSON Lines files, and MATLAB .mat files. Old .xls workbooks are not supported: open them in Excel and save them as .xlsx first.
Can I plot two columns with different units on one chart?
Yes. The MegaRows plotter has a left and a right y-axis: put a temperature on one and a pressure on the other, for example. In Excel use a secondary axis, and in matplotlib use ax.twinx().
Related tools and guides
- PlotterOpen a CSV, Excel, TXT, JSON or MATLAB file with millions of rows and plot it in several linked charts, with zoom and statistics. Works today.
- CSV row counterCount the lines in a CSV, TSV or TXT file of any size. Works today.
- MATLAB .mat file viewerOpen v4 to v7.3 .mat files without MATLAB and plot any signal. Works today.
- Merge CSV filesAppend many CSV files into one, even with different columns or separators. Works today.
- Open a CSV that is too big for ExcelSix ways to work with more than 1,048,576 rows, with honest pros and cons.
- The MegaRows toolboxWhat works today and what is coming next, and why nothing is ever uploaded.
Coming soon to MegaRows: Sort, filter and search · CSV, Excel, JSON and PDF converters · Split and compare.