Matplotlib Plot: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 29: Line 29:
If multiple pairs of <code>x</code>/<code>y</code> arguments are provided, multiple lines are plotted:
If multiple pairs of <code>x</code>/<code>y</code> arguments are provided, multiple lines are plotted:
<syntaxhighlight lang='py'>
<syntaxhighlight lang='py'>
plot([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs)
def plot([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs)
</syntaxhighlight>
</syntaxhighlight>



Revision as of 22:08, 7 October 2023

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