來自知乎大神的乾貨:http://www.zhihu.com/question/21664179html
問題:python
大神們的回答:git
地鐵風,不會擼程序的設計獅不是好科研狗github
plt.fill(x, y1, 'b', x, y2, 'r', alpha=0.3)
plt.scatter(x, y, s=area, alpha=0.5)
ax.plot_surface(X, Y, Z, rstride=8, cstride=8, alpha=0.3) cset = ax.contourf(X, Y, Z, zdir='z', offset=-100, cmap=cm.coolwarm) cset = ax.contourf(X, Y, Z, zdir='x', offset=-40, cmap=cm.coolwarm) cset = ax.contourf(X, Y, Z, zdir='y', offset=40, cmap=cm.coolwarm)
plt.streamplot(X, Y, U, V, color=U, linewidth=2, cmap=plt.cm.autumn) plt.colorbar()
plt.triplot(x, y, triangles, 'go-') plt.title('triplot of user-specified triangulation') plt.xlabel('Longitude (degrees)') plt.ylabel('Latitude (degrees)')
ax = plt.subplot(111, polar=True) bars = ax.bar(theta, radii, width=width, bottom=0.0)
cmap=brewer2mpl.get_map('RdBu', 'diverging', 8, reverse=True).mpl_colormap,
g = sns.jointplot(x1, x2, kind="kde", size=7, space=0)
import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, 10) line, = plt.plot(x, np.sin(x), '--', linewidth=2) dashes = [10, 5, 100, 5] # 10 points on, 5 off, 100 on, 5 off line.set_dashes(dashes) plt.show()
\documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis} \addplot [dash pattern=on 10 off 5 on 100 off 5, domain=0:10, samples=100, very thick, blue] {sin(deg(x))}; \end{axis} \end{tikzpicture} \end{document}
\begin{tikzpicture}
\begin{axis}
\addplot [dash pattern=on 10pt off 5pt on 100pt off 5pt, domain=0:10, samples=100, very thick] {sin(deg(x))};
x = np.linspace(0, 10)
line, = plt.plot(x, np.sin(x), '--', linewidth=2)
dashes = [10, 5, 100, 5] # 10 points on, 5 off, 100 on, 5 off
\documentclass{article} \usepackage{tikz} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis} \addplot [mark = none, blue] table {temperaturesOslo.txt}; \end{axis} \end{tikzpicture} \end{document}
\addplot [mark = none, blue] table {temperaturesOslo.txt};
save('myfile.txt', 'mymatrix', '-ascii','-double');
import matplotlib.pyplot as plt import numpy as np x = np.linspace(0, 2*np.pi, 50) y = np.sin(x) y2 = y + 0.1 * np.random.normal(size=x.shape) fig, ax = plt.subplots() ax.plot(x, y, 'k--') ax.plot(x, y2, 'ro') plt.show()
from matplotlib import rc rc('font', **{'family': 'sans-serif', 'sans-serif': ['Arial'], 'size': 8}) params = {'text.usetex': False, 'mathtext.fontset': 'stixsans'} plt.rcParams.update(params)
fig, ax = plt.subplots(num=1, figsize=(3.54, 2.26))
plt.subplots_adjust(right=0.99, left=0.125, bottom=0.14, top=0.975)
cm_number = 6
cm = plt.cm.get_cmap("Set1", cm_number)
color = []
for i in range(0, cm_number):
color.append(cm(1. / (cm_number - 1) * i))
ax.plot(x, y2, 'o', markerfacecolor=color[0], markersize=2, markeredgecolor=color[0])
ax.spines["right"].set_visible(False) ax.spines["top"].set_visible(False)
ax.xaxis.grid(True, which='major', lw=0.5, linestyle='--', color='0.8',
zorder=1)
ax.yaxis.grid(True, which='major', lw=0.5, linestyle='--', color='0.8',
zorder=1)