Matplotlib Plot

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

External

Internal

Overview

import matplotlib.pyplot as plt

plt.style.use('seaborn-v0_8-whitegrid')

x = [1, 2, 3]
y = [10, 23, 4]

fig, ax = plt.subplots()

ax.plot(x, y)

Difference between Plot and Scatter

Difference between Plot and Scatter

Input Data

plot([x], y, [fmt], ...)

The coordinates of the points or line nodes are given by x, y.

Multiple Series

If multiple pairs of x/y arguments are provided, multiple lines are plotted:

def plot([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs)

Style

To set globally, see:

Visualization Style

Line Width and Color

Axes

Grid Lines