Skip to main content

MatPlot Detective

After Graph Detective — that one fixed y = f(x). This one you write the matplotlib yourself.

改 plt 代码,按运行,让你的图对上左边。 Fix the matplotlib, press Run, match the target.

Use the pyplot names (PtPlot myPlot.* maps over):

CommandEffect
plot(x, y, '-', lw=2)x-y line, width 2
show()show graph
xlabel('x') / ylabel('f(x)')axis labels
title('f vs. x')title
text(x, y, 's')text at (x, y)
plot vs scatterconnect points / no connect
errorbarpoint + error bar
clf()clear figure
scatterscatter plot
polarpolar plot
xlim / ylimx/y range
figure(figsize=(5, 4))size 500×400 px at dpi 100
semilogx / semilogylog x / log y
grid(True)grid
color="black"black & white
autoscale()fit ranges to data
stemvertical impulses
contourcontour lines
barbar chart
gca()current axis
acorrautocorrelation

Zoom buttons (setButtons) need an interactive window — not this Agg sandbox. Practice zoom, save, print, menus, subplot spacing, and the sliding-box beam in MatPlot Studio.