最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Matlab、Python為工具解析數(shù)據(jù)可視化之美

 更新時(shí)間:2021年11月16日 14:45:23   作者:CaiBirdHu  
下面介紹一些數(shù)據(jù)可視化的作品(包含部分代碼),主要是地學(xué)領(lǐng)域,可遷移至其他學(xué)科,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友參考下吧

在我們科研、工作中,將數(shù)據(jù)完美展現(xiàn)出來尤為重要。
數(shù)據(jù)可視化是以數(shù)據(jù)為視角,探索世界。我們真正想要的是 — 數(shù)據(jù)視覺,以數(shù)據(jù)為工具,以可視化為手段,目的是描述真實(shí),探索世界。
下面介紹一些數(shù)據(jù)可視化的作品(包含部分代碼),主要是地學(xué)領(lǐng)域,可遷移至其他學(xué)科。

Example 1 :散點(diǎn)圖、密度圖(Python)

import numpy as np
import matplotlib.pyplot as plt

# 創(chuàng)建隨機(jī)數(shù)
n = 100000
x = np.random.randn(n)
y = (1.5 * x) + np.random.randn(n)
fig1 = plt.figure()
plt.plot(x,y,'.r')
plt.xlabel('x')
plt.ylabel('y')
plt.savefig('2D_1V1.png',dpi=600)

nbins = 200
H, xedges, yedges = np.histogram2d(x,y,bins=nbins)
# H needs to be rotated and flipped
H = np.rot90(H)
H = np.flipud(H)
# 將zeros mask
Hmasked = np.ma.masked_where(H==0,H) 
# Plot 2D histogram using pcolor
fig2 = plt.figure()
plt.pcolormesh(xedges,yedges,Hmasked)  
plt.xlabel('x')
plt.ylabel('y')
cbar = plt.colorbar()
cbar.ax.set_ylabel('Counts')
plt.savefig('2D_2V1.png',dpi=600)
plt.show()

example-figure

在這里插入圖片描述

Example 2 :雙Y軸(Python)

import csv
import pandas as pd
import matplotlib.pyplot as plt
from datetime import datetime

data=pd.read_csv('LOBO0010-2020112014010.tsv',sep='\t')
time=data['date [AST]']
sal=data['salinity']
tem=data['temperature [C]']
print(sal)
DAT = []
for row in time:
DAT.append(datetime.strptime(row,"%Y-%m-%d %H:%M:%S"))

#create figure
fig, ax =plt.subplots(1)
# Plot y1 vs x in blue on the left vertical axis.
plt.xlabel("Date [AST]")
plt.ylabel("Temperature [C]", color="b")
plt.tick_params(axis="y", labelcolor="b")
plt.plot(DAT, tem, "b-", linewidth=1)
plt.title("Temperature and Salinity from LOBO (Halifax, Canada)")
fig.autofmt_xdate(rotation=50)
 
# Plot y2 vs x in red on the right vertical axis.
plt.twinx()
plt.ylabel("Salinity", color="r")
plt.tick_params(axis="y", labelcolor="r")
plt.plot(DAT, sal, "r-", linewidth=1)
  
#To save your graph
plt.savefig('saltandtemp_V1.png' ,bbox_inches='tight')
plt.show()

在這里插入圖片描述

Example 3:擬合曲線(Python)

import csv
import numpy as np
import pandas as pd
from datetime import datetime
import matplotlib.pyplot as plt
import scipy.signal as signal

data=pd.read_csv('LOBO0010-20201122130720.tsv',sep='\t')
time=data['date [AST]']
temp=data['temperature [C]']
datestart = datetime.strptime(time[1],"%Y-%m-%d %H:%M:%S")
DATE,decday = [],[]
for row in time:
    daterow = datetime.strptime(row,"%Y-%m-%d %H:%M:%S")
    DATE.append(daterow)
    decday.append((daterow-datestart).total_seconds()/(3600*24))
# First, design the Buterworth filter
N  = 2    # Filter order
Wn = 0.01 # Cutoff frequency
B, A = signal.butter(N, Wn, output='ba')
# Second, apply the filter
tempf = signal.filtfilt(B,A, temp)
# Make plots
fig = plt.figure()
ax1 = fig.add_subplot(211)
plt.plot(decday,temp, 'b-')
plt.plot(decday,tempf, 'r-',linewidth=2)
plt.ylabel("Temperature (oC)")
plt.legend(['Original','Filtered'])
plt.title("Temperature from LOBO (Halifax, Canada)")
ax1.axes.get_xaxis().set_visible(False)
 
ax1 = fig.add_subplot(212)
plt.plot(decday,temp-tempf, 'b-')
plt.ylabel("Temperature (oC)")
plt.xlabel("Date")
plt.legend(['Residuals'])
plt.savefig('tem_signal_filtering_plot.png', bbox_inches='tight')
plt.show()

在這里插入圖片描述

Example 4:三維地形(Python)

# This import registers the 3D projection
from mpl_toolkits.mplot3d import Axes3D  
from matplotlib import cbook
from matplotlib import cm
from matplotlib.colors import LightSource
import matplotlib.pyplot as plt
import numpy as np

filename = cbook.get_sample_data('jacksboro_fault_dem.npz', asfileobj=False)
with np.load(filename) as dem:
    z = dem['elevation']
    nrows, ncols = z.shape
    x = np.linspace(dem['xmin'], dem['xmax'], ncols)
    y = np.linspace(dem['ymin'], dem['ymax'], nrows)
x, y = np.meshgrid(x, y)

region = np.s_[5:50, 5:50]
x, y, z = x[region], y[region], z[region]
fig, ax = plt.subplots(subplot_kw=dict(projection='3d'))
ls = LightSource(270, 45)

rgb = ls.shade(z, cmap=cm.gist_earth, vert_exag=0.1, blend_mode='soft')
surf = ax.plot_surface(x, y, z, rstride=1, cstride=1, facecolors=rgb,
                       linewidth=0, antialiased=False, shade=False)
plt.savefig('example4.png',dpi=600, bbox_inches='tight')
plt.show()

在這里插入圖片描述

Example 5:三維地形,包含投影(Python)

在這里插入圖片描述

Example 6:切片,多維數(shù)據(jù)同時(shí)展現(xiàn)(Python)

在這里插入圖片描述

Example 7:SSH GIF 動(dòng)圖展現(xiàn)(Matlab)

在這里插入圖片描述

Example 8:Glider GIF 動(dòng)圖展現(xiàn)(Python)

在這里插入圖片描述

Example 9:渦度追蹤 GIF 動(dòng)圖展現(xiàn)

在這里插入圖片描述

到此這篇關(guān)于數(shù)據(jù)可視化之美 -- 以Matlab、Python為工具的文章就介紹到這了,更多相關(guān)python數(shù)據(jù)可視化之美內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • PyQt5 關(guān)于Qt Designer的初步應(yīng)用和打包過程詳解

    PyQt5 關(guān)于Qt Designer的初步應(yīng)用和打包過程詳解

    Qt Designer中的操作方式十分靈活,其通過拖拽的方式放置控件可以隨時(shí)查看控件效果。這篇文章主要介紹了PyQt5 關(guān)于Qt Designer的初步應(yīng)用和打包,需要的朋友可以參考下
    2021-09-09
  • python繪圖pyecharts+pandas的使用詳解

    python繪圖pyecharts+pandas的使用詳解

    這篇文章主要介紹了python繪圖pyecharts+pandas的使用詳解,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-12-12
  • Python中Word文件自動(dòng)化操作小結(jié)

    Python中Word文件自動(dòng)化操作小結(jié)

    Python-docx是一個(gè)Python庫,提供了對(duì)Microsoft?Word(.docx文件)的讀寫和修改功能,本文主要介紹了如何使用Python-docx實(shí)現(xiàn)Word文件自動(dòng)化操作,需要的可以參考下
    2024-04-04
  • Django 路由層URLconf的實(shí)現(xiàn)

    Django 路由層URLconf的實(shí)現(xiàn)

    這篇文章主要介紹了Django 路由層URLconf的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-12-12
  • Python調(diào)用ChatGPT的API實(shí)現(xiàn)文章生成

    Python調(diào)用ChatGPT的API實(shí)現(xiàn)文章生成

    最近ChatGPT大火,在3.5版本后開放了接口API,所以很多人開始進(jìn)行實(shí)操,這里我就用python來為大家實(shí)現(xiàn)一下,如何調(diào)用API并提問返回文章的說明
    2023-03-03
  • Python實(shí)現(xiàn)最常見加密方式詳解

    Python實(shí)現(xiàn)最常見加密方式詳解

    這篇文章主要介紹了Python實(shí)現(xiàn)最常見加密方式詳解,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2019-07-07
  • Python排序算法之插入排序及其優(yōu)化方案詳解

    Python排序算法之插入排序及其優(yōu)化方案詳解

    今天給大家?guī)淼奈恼率顷P(guān)于Python的相關(guān)知識(shí),文章圍繞著Python插入排序及其優(yōu)化方案展開,文中有非常詳細(xì)的介紹及代碼示例,需要的朋友可以參考下
    2021-06-06
  • Python selenium使用autoIT上傳附件過程詳解

    Python selenium使用autoIT上傳附件過程詳解

    這篇文章主要介紹了Python selenium使用autoIT上傳附件過程詳解,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-05-05
  • Python提取轉(zhuǎn)移文件夾內(nèi)所有.jpg文件并查看每一幀的方法

    Python提取轉(zhuǎn)移文件夾內(nèi)所有.jpg文件并查看每一幀的方法

    今天小編就為大家分享一篇Python提取轉(zhuǎn)移文件夾內(nèi)所有.jpg文件并查看每一幀的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2019-06-06
  • python使用pandas實(shí)現(xiàn)數(shù)據(jù)分割實(shí)例代碼

    python使用pandas實(shí)現(xiàn)數(shù)據(jù)分割實(shí)例代碼

    這篇文章主要介紹了python使用pandas實(shí)現(xiàn)數(shù)據(jù)分割實(shí)例代碼,介紹了使用pandas實(shí)現(xiàn)對(duì)dataframe格式的數(shù)據(jù)分割成時(shí)間跨度相等的數(shù)據(jù)塊,分享了相關(guān)代碼示例,小編覺得還是挺不錯(cuò)的,具有一定借鑒價(jià)值,需要的朋友可以參考下
    2018-01-01

最新評(píng)論

页游| 商南县| 霍山县| 洪洞县| 象山县| 莒南县| 托克托县| 都江堰市| 定陶县| 合水县| 县级市| 太仓市| 尖扎县| 北流市| 彰武县| 南木林县| 清镇市| 革吉县| 罗源县| 德令哈市| 青阳县| 岗巴县| 运城市| 绩溪县| 抚州市| 沅陵县| 石林| 六安市| 谢通门县| 沙田区| 金门县| 顺义区| 嘉峪关市| 临泉县| 仁化县| 兴海县| 贵定县| 明星| 海安县| 双江| 鲁甸县|