File:Interpolation-bilinear.svg

原始檔案(SVG 檔案,表面大小:450 × 450 像素,檔案大小:86 KB)


摘要

描述
English: Illustration of Bilinear interpolation on a random dataset. Compare with other interpolation methods that share the same dataset: File:Interpolation-bilinear.svg File:Interpolation-bicubic.svg File:Interpolation-hermite.svg
日期
來源 自己的作品
作者 Zykure
SVG開發
InfoField
 
SVG檔案的原始碼通過W3C驗證
 
向量圖形使用Matplotlib創作。
原始碼
InfoField

Python code

#!/usr/bin/env python
# -*- encoding: utf-8 -*-

import sys
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rcParams

rcParams['font.size'] = 18

# Available interpolation methods:
# 'none', 'nearest', 'bilinear', 'bicubic', 'spline16',
# 'spline36', 'hanning', 'hamming', 'hermite', 'kaiser', 'quadric',
# 'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc', 'lanczos'

METHODS = [ 'nearest', 'bilinear', 'bicubic', 'hermite' ]
FORMATS = [ 'png', 'pdf', 'svg' ]
COLORS  = 'viridis'

N = 5
np.random.seed(1)
grid = np.arange(0, N, 1)
data = np.round(np.random.rand(N, N), 1)
mesh = np.meshgrid(grid, grid)

for interp in METHODS:

    fig = plt.figure(figsize=(5,5))

    ax = fig.add_axes([0.125, 0.175, 0.75, 0.75])
    plt.imshow(data, interpolation=interp, cmap=COLORS, vmin=0, vmax=1)
    plt.plot(mesh[0], mesh[1], marker='.', ms=8, color='k', lw=0)
    plt.title(interp, weight='bold')
    plt.xlim(grid.min()-0.5, grid.max()+0.5)
    plt.ylim(grid.min()-0.5, grid.max()+0.5)
    plt.xticks(grid)
    plt.yticks(grid)

    cax = fig.add_axes([0.125, 0.075, 0.75, 0.03])
    cb = plt.colorbar(cax=cax, orientation='horizontal',
                      ticks=np.linspace(0, 1, 6))
    cb.solids.set_edgecolor('face')

    for ext in FORMATS:
        plt.savefig("{}_{}.{}".format(sys.argv[0], interp, ext))

授權條款

我,本作品的著作權持有者,決定用以下授權條款發佈本作品:
w:zh:創用CC
姓名標示 相同方式分享
您可以自由:
  • 分享 – 複製、發佈和傳播本作品
  • 重新修改 – 創作演繹作品
惟需遵照下列條件:
  • 姓名標示 – 您必須指名出正確的製作者,和提供授權條款的連結,以及表示是否有對內容上做出變更。您可以用任何合理的方式來行動,但不得以任何方式表明授權條款是對您許可或是由您所使用。
  • 相同方式分享 – 如果您利用本素材進行再混合、轉換或創作,您必須基於如同原先的相同或兼容的條款,來分布您的貢獻成品。

說明

添加單行說明來描述出檔案所代表的內容

在此檔案描寫的項目

描繪內容

檔案來源 Chinese (Taiwan) (已轉換拼寫)

檔案歷史

點選日期/時間以檢視該時間的檔案版本。

日期/時間縮⁠圖尺寸使用者備⁠註
目前2018年3月31日 (六) 23:57於 2018年3月31日 (六) 23:57 版本的縮圖450 × 450(86 KB)NicoguaroChange colormap to viridis.
2016年9月1日 (四) 08:15於 2016年9月1日 (四) 08:15 版本的縮圖450 × 450(164 KB)ZykureUser created page with UploadWizard

下列頁面有用到此檔案:

全域檔案使用狀況

以下其他 wiki 使用了這個檔案:

詮釋資料