matplotlib
차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판이전 판다음 판 | 이전 판 | ||
matplotlib [2019/04/02 20:06] – [Seaborn] rex8312 | matplotlib [2024/03/23 02:38] (현재) – 바깥 편집 127.0.0.1 | ||
---|---|---|---|
줄 3: | 줄 3: | ||
===== Animation ===== | ===== Animation ===== | ||
- | | + | |
+ | * [[https:// | ||
줄 75: | 줄 76: | ||
* https:// | * https:// | ||
+ | |||
+ | ===== imshow ===== | ||
+ | |||
+ | <code python> | ||
+ | fig, (ax1, ax2) = plt.subplots(1, | ||
+ | cs = list() | ||
+ | min_diff = 0.5 | ||
+ | xs = np.arange(0, | ||
+ | |||
+ | ax1.imshow(xs, | ||
+ | for x in xs.reshape(-1): | ||
+ | b = x / 10 | ||
+ | w = 1 - b | ||
+ | if b < 0.5: | ||
+ | c = (1 - min_diff) * w + min_diff | ||
+ | else: | ||
+ | c = (1 - min_diff) * w | ||
+ | c = np.clip(c, 0, 1) | ||
+ | cs.append(c) | ||
+ | ax1.text(0, | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | ax2.scatter(xs, | ||
+ | plt.show() | ||
+ | </ | ||
+ | |||
+ | ===== Radar chart ===== | ||
+ | |||
+ | * https:// | ||
+ | |||
+ | <code python> | ||
+ | kvs = dict(a=1.0, b=0.2, c=0.4, d=0.5, e=0.7) | ||
+ | fig = plt.figure() | ||
+ | ax = fig.add_subplot(111, | ||
+ | ax.set_title(f' | ||
+ | ax.set_ylim([0, | ||
+ | theta = np.linspace(0.0, | ||
+ | ax.set_xticks(theta) | ||
+ | ax.set_xticklabels([f' | ||
+ | vs = np.hstack([list(kvs.values()), | ||
+ | ax.plot(theta, | ||
+ | ax.fill_between(theta, | ||
+ | plt.show() | ||
+ | plt.close() | ||
+ | </ | ||
+ | |||
+ | ===== Subplot ===== | ||
+ | |||
+ | * https:// | ||
+ | |||
+ | ===== Embedded plot ===== | ||
+ | |||
+ | <code python> | ||
+ | fig, ax = plt.subplots(1, | ||
+ | |||
+ | data = np.array([ | ||
+ | np.random.random(2), | ||
+ | np.random.random(2), | ||
+ | np.random.random(2), | ||
+ | ]) | ||
+ | |||
+ | subdata = np.array([ | ||
+ | np.random.random(3), | ||
+ | np.random.random(3), | ||
+ | np.random.random(3), | ||
+ | ]) | ||
+ | |||
+ | scatter = ax.scatter(data[:, | ||
+ | ax.set_xlim([-0.2, | ||
+ | ax.set_ylim([-0.2, | ||
+ | |||
+ | for idx, (x, y) in enumerate(data): | ||
+ | subdata_ = subdata[idx] | ||
+ | box = ax.get_position() | ||
+ | width = box.width * 0.2 | ||
+ | height = box.height * 0.2 | ||
+ | xmin, xmax, ymin, ymax = ax.axis() | ||
+ | nx = (x - xmin) / (xmax - xmin) - width / 2 | ||
+ | ny = (y - ymin) / (ymax - ymin) - height / 2 | ||
+ | inax_position | ||
+ | transFigure = fig.transFigure.inverted() | ||
+ | infig_position = transFigure.transform(inax_position) | ||
+ | x = infig_position[0] | ||
+ | y = infig_position[1] | ||
+ | subax = fig.add_axes([x, | ||
+ | subax.get_xaxis().set_visible(False) | ||
+ | subax.get_yaxis().set_visible(False) | ||
+ | subax.plot(subdata_) | ||
+ | plt.show() | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ===== Neural Net Weights/ | ||
+ | |||
+ | * [[https:// | ||
+ | |||
matplotlib.1554235582.txt.gz · 마지막으로 수정됨: (바깥 편집)