Line chart
import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4], [1, 4, 2, 5], marker="o")
plt.xlabel("Step")
plt.ylabel("Score")
plt.title("Progress")
plt.grid(alpha=.25)
plt.tight_layout()Tap Run to execute
main.py · output appears here
Press Run to execute
Output streams here as your program runs.
Matplotlib is Python’s foundational plotting library for line, bar, scatter, histogram, image, and publication-quality figure output. Its pyplot API offers a concise stateful workflow, while the object-oriented Figure and Axes APIs give precise control over labels, scales, legends, annotations, and layouts.
CompileBytes runs Python 3.14.6 with Matplotlib 3.11.1, NumPy 2.5.1, and pandas 3.0.3 in an isolated hosted scientific runtime. The non-interactive Agg backend captures up to six PNG figures and displays them with console output. Unsaved open figures are captured automatically; GUI backends, uploads, network access, and persistent files are unavailable.
main.py is the entry point for each run.
Use the Input panel to pipe standard input to your program when it needs data.
Run sends your code to a fresh hosted runtime and streams the result into the output panel.
Your draft stays in this browser, and Share creates a separate snapshot link.
import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4], [1, 4, 2, 5], marker="o")
plt.xlabel("Step")
plt.ylabel("Score")
plt.title("Progress")
plt.grid(alpha=.25)
plt.tight_layout()import matplotlib.pyplot as plt
labels = ["A", "B", "C"]
values = [12, 19, 8]
plt.bar(labels, values, color=["#6366f1", "#14b8a6", "#f59e0b"])
plt.ylabel("Count")
plt.tight_layout()import numpy as np
import matplotlib.pyplot as plt
rng = np.random.default_rng(7)
x = rng.normal(size=100)
y = .7*x + rng.normal(scale=.5, size=100)
plt.scatter(x, y, alpha=.65)
plt.tight_layout()import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 2*np.pi, 200)
fig, axes = plt.subplots(1, 2, figsize=(8, 3))
axes[0].plot(x, np.sin(x)); axes[0].set_title("sin")
axes[1].plot(x, np.cos(x)); axes[1].set_title("cos")
fig.tight_layout()import numpy as np
import matplotlib.pyplot as plt
values = np.random.default_rng(42).normal(size=1000)
plt.hist(values, bins=30, edgecolor="white")
plt.title("Normal sample")
plt.tight_layout()The editor uses Monaco, the engine behind VS Code, with language-aware editing tools and familiar keyboard controls.
Type or paste your code into the editor, then click Run (or press Ctrl/Cmd + Enter) to execute it.
Output streams into the console panel, including runtime errors, exit status, and execution time.
Nothing to install and no account to create — code runs in an isolated hosted runtime.
Language-aware autocomplete and IntelliSense suggestions where the editor has a matching language service
Syntax highlighting, with native compiler and runtime errors shown in the console
Bracket matching, auto-indentation, code folding, and a minimap
Multi-cursor editing plus find & replace (Ctrl/Cmd + F)
Full undo/redo history and copy to clipboard
Built on Monaco — the same editor that powers VS Code
Run on demand, or turn on Auto-run to execute on every change
Stop long-running or infinite programs at any time
A real console shows standard output, errors, exit status, and execution time
Pass standard input (stdin) to your program from the Input panel — one value per line
Switch between light and dark themes
Adjust font size and other editor settings
Toggle side-by-side or top/bottom layouts
Enter distraction-free fullscreen mode
Generate a shareable link to your exact code in one click — no login needed
Your work autosaves to your browser, so you can pick up where you left off
Copy the active file to your clipboard
Run code: Ctrl/Cmd + Enter
Find & replace: Ctrl/Cmd + F
Open the full shortcut list from the keyboard icon in the toolbar
Matplotlib is one of 46 single-file compiler scratchpads. Each run submits only main.py; local sibling-file imports are not enabled.
Linked-project languages (23): Node.js, TypeScript, Deno, Python, C, Go, Dart, Swift, Rust, Ruby, PHP, Java, Kotlin, C++, C#, Nim, Crystal, Haxe, Zig, Scala, D, Bun, Objective-C.
Single-file scratchpads (46): Matplotlib, NumPy, pandas, Haskell, Clojure, Perl, Lua, Tcl, jq, Raku, Elixir, Bash, Zsh, Nushell, R, Assembly (NASM), Julia, Octave, Groovy, PowerShell, Visual Basic .NET, Odin, Pascal, Lisp, Erlang, CoffeeScript, COBOL, BASIC, V, Racket, OCaml, Prolog, AWK, Emacs Lisp, Emojicode, Forth, F#, Fortran, Assembly (NASM64), Solidity, Mojo, Ada, WASM (WAT), Gleam, Shell Script (sh), Scheme.
Download file exports the active Matplotlib source file.