Legend - VUB

Scales

P. ROUGIER

Basic plots

API

DESIGNED BY NICOLAS

756

432

0.0

0.0

1

2.5

2.5 10 1 logit

symlog

2

0

2

Quick start

765 1234567 X,scatter(X,Y,¡­)

0.0

0.0

Y, [s]izes, [c]olors, markers, cmap

any values

0 < values < 1

423

import numpy as np

2.5 1000100

2.5 1

1

import matplotlib as mpl

2

import matplotlib.pyplot as plt

Projections

6754 1234567 x,bar[h](x,height,¡­)

height, width, bottom, align, color

321

subplot(¡­,projection=p)

X = np.linspace(0, 2*np.pi, 100)

p=¡¯polar¡¯

p=¡¯3d¡¯

765 1234567 imshow(Z,[cmap],¡­)

Y = np.cos(X)

Z, cmap, interpolation, extent, origin

3421

fig, ax = plt.subplots()

ax.plot(X,Y,color=¡¯C1¡¯)

p=Orthographic()

6754 1234567 contour[f]([X],[Y],Z?¡­)

from cartopy.crs import Cartographic

X, Y, Z, levels, colors, extent, origin

fig.savefig(¡°figure.pdf¡±)

3

21

fig.show()

765 1234567 quiver([X],[Y],U,V,¡­)

X, Y, U, V, C, units, angles

Lines

Anatomy of a figure

3421

linestyle or ls

765 1234567 pie(X,[explode],¡­)

Anatomy of a figure

Z, explode, labels, colors, radius

432

capstyle or dash_capstyle

1

text(x,y,text,¡­)

765 1234567T x, y, text, va, ha, size, weight, transform

432 TEX

Markers

1

¡­ )

765 1234567 X,fill[_between][x](

Y1, Y2, color, where

432

1

1234567

Advanced plots

step(X,Y,[fmt],¡­)

765

X, Y, fmt, color, marker, where

10

[0, -1]

(25, 5)

[0, 25, -1]

432

1

765 1234567 X,boxplot(X,¡­)

Colors

notch, sym, bootstrap, widths

432

Subplots layout

1

765 246 X,errorbar(X,Y,xerr,yerr,¡­)

subplot[s](cols,rows,¡­)

Y, xerr, yerr, fmt

fig, axs = plt.subplots(3,3) 4

312

bins, ¡­)

71

61

1234567 X,hist(X,

G = gridspec(cols,rows,¡­)

bins, range, density, weights

51

41

ax = G[0,:]

31

Colormaps

21

111

plt.get_cmap(name)

765 1234567 violinplot(D,¡­)

ax.inset_axes(extent)

D, positions, widths, vert

423

Uniform

1

U, V, ¡­)

6754 1234567 barbs([X],[Y],

d=make_axes_locatable(ax)

X, Y, U, V, C, length, pivot, sizes

ax=d.new_horizontal(¡¯10%¡¯)

321

Sequential

765 1234567 eventplot(positions,¡­)

positions, orientation, lineoffsets

423

Diverging

Getting help

1

hexbin(X,Y,C,¡­)



6754 1234567 X, Y, C, gridsize, bins

matplotlib/matplotlib/issues

321

discourse.

Qualitative

matplotlib

0.2500

xcorr(X,Y,¡­)

0.1875

0.1250

gitter.im/matplotlib

1234567 X, Y, normed, detrend

0.0625

0.0000

matplotlib

Cyclic

0.0625

0.1250

Matplotlib users mailing list

0.1875

0.2500

Cheat sheet

Version 3.2

API

plot([X],Y,[fmt],¡­)

X, Y, fmt, color, marker, linestyle

API

ax.set_[xy]scale(scale,¡­)

linear

log

+ any values

0

+ values > 0

API

-

+

0

1

API

API

API

API

API

API

"-"

4

Title

Blue signal

Red signal

Legend

":"

"--"

"butt"

API

Minor tick

"-."

"round"

(0,(0.01,2))

"projecting"

3

Major tick label

Grid

API

Y axis label

Line

(line plot)

API

2

Y axis label

Markers

(scatter plot)

1

Figure

0

'.'

'o'

's'

'P'

'X'

'*'

'p'

'D'

''

'^'

'v'

'1'

'2'

'3'

'4'

'+'

'x'

'|'

'_'

4

5

6

7

'$ $''$ $''$ $''$ $''$ $''$ $''$ $''$ $''$ $''$ $''$ $''$ $'

Axes

Line

(line plot)

API

Spines

0 0.25 0.50 0.75 1 1.25 1.50 1.75 2 2.25 2.50 2.75 3 3.25 3.50 3.75 4

X axis label

Minor tick label

X axis label

markevery

API

API

API

API

API

API

0.0

0.5

1.0

1.5

2.0

2.5

3.0

3.5

4.0

4.5

5.0

ticker.FixedLocator([0, 1, 5])

0

1

5

ticker.LinearLocator(numticks=3)

0.0

2.5

5.0

ticker.IndexLocator(base=0.5, offset=0.25)

0.25

0.75

1.25

1.75

2.25

2.75

3.25

ticker.AutoLocator()

0

1

2

ticker.MaxNLocator(n=4)

0.0

3.75

3

1.5

4.25

4.75

4

5

3.0

Styles

4.5

ticker.LogLocator(base=10, numticks=15)

104

103

105

107

106

108

109

API

API

API

Greys

YlOrBr

Wistia

API

API

API

Spectral

coolwarm

RdGy

tab10

tab20

twilight

0.5

0.0

0.0

0.5

1.0

0

1

2

3

4

5

1.0

6

ggplot

0.25 0.50 1 0.75

0

0.25 2 0.50 0.75

3 0.25 0.50 0.75 4

[1.00]

[2.00]

[3.00]

[4.00]

ticker.FormatStrFormatter('>%d ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download