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):
| Command | Effect |
|---|---|
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 scatter | connect points / no connect |
errorbar | point + error bar |
clf() | clear figure |
scatter | scatter plot |
polar | polar plot |
xlim / ylim | x/y range |
figure(figsize=(5, 4)) | size 500×400 px at dpi 100 |
semilogx / semilogy | log x / log y |
grid(True) | grid |
color="black" | black & white |
autoscale() | fit ranges to data |
stem | vertical impulses |
contour | contour lines |
bar | bar chart |
gca() | current axis |
acorr | autocorrelation |
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.