Matplotlib Plot: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 6: Line 6:
* [[Matplotlib#Plot|matplotlib]]
* [[Matplotlib#Plot|matplotlib]]
=Overview=
=Overview=
<syntaxhighlight lang='py'>
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)
</syntaxhighlight>
=Difference between Plot and Scatter=
=Difference between Plot and Scatter=
{{Internal|Matplotlib#Difference_between_Plot_and_Scatter|Difference between Plot and Scatter}}
{{Internal|Matplotlib#Difference_between_Plot_and_Scatter|Difference between Plot and Scatter}}

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:

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

Style

To set globally, see:

Visualization Style

Line Width and Color

Axes

Grid Lines