파일:Mpl screenshot figures and code.png

원본 파일(1,227 × 978 픽셀, 파일 크기: 350 KB, MIME 종류: image/png)

파일 설명

설명
English: A screenshot showing matplotlib plots of a polar bar graph resembling the matplotlib logo (upper left), a 3D surface graph with the new default 'viridis' colormap (lower left), a graph of 2D random walk trajectories (lower right), and the python source code (of the logo part) opened in a text editor (upper right).
날짜
출처 자작
저자 Adrien F. Vincent

Rationale: this work aims at providing an up-to-date version of the previous work https://en.wikipedia.org/wiki/File:Matplotlib_screenshot.png , done by Geek3.

The matplotlib (mpl) version is the development branch 2.x, with Python 2.7.11 and numpy 1.11.1

##########
## Code for the mpl logo figure
##########
import matplotlib.pyplot as plt
import numpy as np

from matplotlib.cm import jet as colormap
from matplotlib.ticker import NullFormatter, MultipleLocator

t, w, r = zip((0.1, 0.4, 1), (0.9, 0.3, 5), (1.7, 0.5, 7), (2.7, 0.6, 6),
              (3.5, 0.3, 3), (4.5, 0.4, 4), (5.3, 0.3, 7))

fig, ax = plt.subplots(subplot_kw={'polar': True})
bars = ax.bar(t, r, width=w, bottom=0.0, lw=2, edgecolor='Black', zorder=2)

for r, bar in zip(r, bars):
    bar.set_facecolor(colormap(r / 9.0))
    bar.set_alpha(0.7)

ax.yaxis.set_major_locator(MultipleLocator(2))

for axis in (ax.xaxis, ax.yaxis):
    axis.set_major_formatter(NullFormatter())  # no tick labels

ax.set_ylim([0, 8])
ax.grid(True)

plt.show()
####################
##########
## Code for the 3D surface plot and the 2D random walk tajectories
##########
import matplotlib.pyplot as plt
import numpy as np

from mpl_toolkits.mplot3d import Axes3D
from matplotlib.cm import viridis as colormap

"""
Figure 1: a 3D surface plot (from matplotlib gallery)
"""
step = 0.04
maxval = 1.0
fig1 = plt.figure("Figure_1")
ax1 = fig1.add_subplot(111, projection='3d')

# Create supporting points in polar coordinates
r = np.linspace(0, 1.2, 50)
p = np.linspace(0, 2*np.pi, 50)
R, P = np.meshgrid(r, p)
# Transform them to cartesian system
X, Y = R*np.cos(P), R*np.sin(P)

Z = ((R**2 - 1)**2)
ax1.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=colormap)
ax1.set_zlim3d(0, 1)
ax1.set_xlabel(r'$\phi_\mathrm{real}$')
ax1.set_ylabel(r'$\phi_\mathrm{im}$')
ax1.set_zlabel(r'$V(\phi)$')

"""
Figure 2: a few examples of 2D random walk
"""
fig2, ax2 = plt.subplots(num="Figure_2")

prng = np.random.RandomState(123)

x = np.linspace(0, 10, 101)

def random_walk(xy0=(0.0, 0.0), nsteps=100, std=1.0):
    xy = np.zeros((nsteps + 1, 2))
    xy[0,:] = xy0
    deltas = prng.normal(loc=0.0, scale=std, size=(nsteps, 2))
    xy[1:, :] = xy[0, :] + np.cumsum(deltas, axis=0)
    return xy

for cnt in range(3):
    traj = random_walk()
    ax2.plot(traj[:, 0], traj[:, 1], label="Traj. {c}".format(c=cnt))

ax2.legend(loc='best')

plt.show()
####################

라이선스

나는 아래 작품의 저작권자로서, 이 저작물을 다음과 같은 라이선스로 배포합니다:
w:ko:크리에이티브 커먼즈
저작자표시 동일조건변경허락
이용자는 다음의 권리를 갖습니다:
  • 공유 및 이용 – 저작물의 복제, 배포, 전시, 공연 및 공중송신
  • 재창작 – 저작물의 개작, 수정, 2차적저작물 창작
다음과 같은 조건을 따라야 합니다:
  • 저작자표시 – 적절한 저작자 표시를 제공하고, 라이센스에 대한 링크를 제공하고, 변경사항이 있는지를 표시해야 합니다. 당신은 합리적인 방식으로 표시할 수 있지만, 어떤 방식으로든 사용권 허가자가 당신 또는 당신의 사용을 지지하는 방식으로 표시할 수 없습니다.
  • 동일조건변경허락 – 만약 당신이 이 저작물을 리믹스 또는 변형하거나 이 저작물을 기반으로 제작하는 경우, 당신은 당신의 기여물을 원저작물과 동일하거나 호환 가능한 라이선스에 따라 배포하여야 합니다.

설명

이 파일이 나타내는 바에 대한 한 줄 설명을 추가합니다

이 파일에 묘사된 항목

다음을 묘사함

파일 역사

날짜/시간 링크를 클릭하면 해당 시간의 파일을 볼 수 있습니다.

날짜/시간섬네일크기사용자설명
현재2016년 9월 27일 (화) 18:522016년 9월 27일 (화) 18:52 판의 섬네일1,227 × 978 (350 KB)Adrien F. VincentUser created page with UploadWizard

다음 문서 1개가 이 파일을 사용하고 있습니다:

이 파일을 사용하고 있는 모든 위키의 문서 목록

다음 위키에서 이 파일을 사용하고 있습니다:

  • bn.wikipedia.org에서 이 파일을 사용하고 있는 문서 목록
  • en.wikipedia.org에서 이 파일을 사용하고 있는 문서 목록
  • fr.wikipedia.org에서 이 파일을 사용하고 있는 문서 목록
  • hu.wikipedia.org에서 이 파일을 사용하고 있는 문서 목록
  • ja.wikipedia.org에서 이 파일을 사용하고 있는 문서 목록
  • pl.wikipedia.org에서 이 파일을 사용하고 있는 문서 목록
  • pt.wikipedia.org에서 이 파일을 사용하고 있는 문서 목록
  • sr.wikipedia.org에서 이 파일을 사용하고 있는 문서 목록
  • tr.wikipedia.org에서 이 파일을 사용하고 있는 문서 목록
  • zh.wikipedia.org에서 이 파일을 사용하고 있는 문서 목록

메타데이터