国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

使用matplotlib繪制3D圖表和統(tǒng)計地圖

這篇具有很好參考價值的文章主要介紹了使用matplotlib繪制3D圖表和統(tǒng)計地圖。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

目錄

使用mplot3D繪制3D圖表

mplot3d概述

繪制3D線框圖(plot_wireframe())

繪制3D曲面圖(plot_surface())

繪制3D條形圖

?繪制3D柱形圖

np.meshgrid()函數(shù)的補充

使用animation制作動圖

例子1

?例子2

使用basemap繪制統(tǒng)計地圖

實例:美國部分城鎮(zhèn)人口分布(basemap)

實例1:三維空間的星星(3D散點圖)

實例2:三維空間閃爍的星星(3D動圖)

編程題(動點)

總結(jié)


使用mplot3D繪制3D圖表

mplot3d概述

'''Axes3D()方法
Axes3D(fig, rect=None, *args, azim=-60, zscale=None,
       sharez=None, prooj_type='persp', **kwargs)
該方法的參數(shù)fig表示所屬畫布,rect表示確定三維坐標(biāo)系位置的元組
'''
# 創(chuàng)建Axes3D類對象的示例代碼如下:
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = Axes3D(fig)

matplotlib 地圖,python,可視化,matplotlib,matplotlib,3d,數(shù)據(jù)可視化,python


'''
官方推薦
add_suplot()方法
在調(diào)用add_suplot()方法添加繪圖區(qū)域時為該方法傳入projection='3d',
即指定坐標(biāo)系的類型為三維坐標(biāo)系,返回一個Axes3D類的對象
'''
# 創(chuàng)建Axes3D類對象的示例代碼如下:
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')

matplotlib 地圖,python,可視化,matplotlib,matplotlib,3d,數(shù)據(jù)可視化,python


繪制3D線框圖(plot_wireframe())

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
# 獲取測試數(shù)據(jù)
X, Y, Z = axes3d.get_test_data(0.05)
# 繪制 3D線框圖
ax.plot_wireframe(X, Y, Z, # 表示x、y、z軸的數(shù)據(jù)
                  rstride=10, cstride=10 # 表示采樣的密度。
                  # 若使用參數(shù)rstride或cstride中任意一個,則另一個參數(shù)默認(rèn)為0
                  # rcount,ccount:表示每個坐標(biāo)軸方向所使用的最大樣本量,默認(rèn)為50
                  # 注意:參數(shù)rstride、cstride與參數(shù)rcount、ccount是互斥關(guān)系,它們不能同時使用
                 )
plt.show()

matplotlib 地圖,python,可視化,matplotlib,matplotlib,3d,數(shù)據(jù)可視化,python


繪制3D曲面圖(plot_surface())

from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as np
# 數(shù)據(jù)
x1 = np.arange(-5, 5, 0.25)
y1 = np.arange(-5, 5, 0.25)
# 對數(shù)據(jù)進行小處理
x1, y1 = np.meshgrid(x1, y1) # X, Y = np.meshgrid(x, y) 代表的是將x中每一個數(shù)據(jù)和y中每一個數(shù)據(jù)組合生成很多點,然后將這些點的x坐標(biāo)放入到X中,y坐標(biāo)放入Y中,并且相應(yīng)位置是對應(yīng)的
r1 = np.sqrt(x1** 2 + y1 ** 2)
z1 = np.sin(r1)
# 畫布
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
# 繪制曲面圖
ax.plot_surface(x1, y1, z1, # 數(shù)據(jù)
                cmap=cm.coolwarm, # 曲面顏色映射表
                linewidth=0,
               ) 
# 設(shè)置 z 軸刻度的范圍
ax.set_zlim(-1.01, 1.01)
plt.show()

matplotlib 地圖,python,可視化,matplotlib,matplotlib,3d,數(shù)據(jù)可視化,python

?


繪制3D條形圖

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d.axes3d import Axes3D
import numpy as np

plt.rcParams['axes.unicode_minus'] = False
plt.rcParams['font.sans-serif'] = ['SimHei']

# 創(chuàng)建畫布
fig = plt.figure()

# 創(chuàng)建3D坐標(biāo)系
axes3d = Axes3D(fig)
# 數(shù)據(jù)
zs = range(5)
left = np.arange(0, 10)
height = np.array([])
for i in range(len(zs)):
    z = zs[i] # 0,1,2,3,4
    height = np.random.randint(0, 30, size=10)
    axes3d.bar(left, # y軸數(shù)據(jù)
               height, # z軸數(shù)據(jù)
               zs=z, # x軸數(shù)據(jù)
               zdir='x',
               color=['red', 'green', 'purple', 'yellow', 'blue', 'black', 'gray', 'orange', 'pink', 'cyan'])
plt.xticks(zs, ['1月份', '2月份', '3月份', '4月份', '5月份'])  # x軸標(biāo)簽
plt.yticks(left, ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'G']) # y軸標(biāo)簽
plt.xlabel('月份') 
plt.ylabel('型號')
plt.show()

matplotlib 地圖,python,可視化,matplotlib,matplotlib,3d,數(shù)據(jù)可視化,python


?繪制3D柱形圖

import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
plt.rcParams['font.sans-serif'] = ['SimHei']

# 數(shù)據(jù)
color = ["blue", "cornflowerblue", "mediumturquoise", "goldenrod", "yellow"]
lambda1 = lambda2 = [10 ** x for x in range(-2, 3)]
# [0.01, 0.1, 1, 10, 100]

# x, y: position
x = list(range(len(lambda1)))
y = list(range(len(lambda2)))
# [0, 1, 2, 3, 4]


x_tickets = [str(_x) for _x in lambda1] # 將其轉(zhuǎn)換為string類型
y_tickets = [str(_x) for _x in lambda2]
# ['0.01', '0.1', '1', '10', '100']

# acc = np.random.rand(len(x), len(y))
acc = np.arange(len(x) * len(y)).reshape(len(x), len(y)) + 1 # 轉(zhuǎn)換為5行5列的二維數(shù)組,第一位為1
acc = acc / acc.max()

xx, yy = np.meshgrid(x, y)# 將x中每一個數(shù)據(jù)和y中每一個數(shù)據(jù)組合生成很多點,然后將這些點的x坐標(biāo)放入到xx中,y坐標(biāo)放入yy中,并且相應(yīng)位置是對應(yīng)的

color_list = [] # 定義一個列表
for i in range(len(y)):
    c = color[i] #  選擇顏色
    color_list.append([c] * len(x)) # 把顏色放入列表,并乘以x軸長度,以便每個柱形圖都有顏色
color_list = np.asarray(color_list) # 將輸入轉(zhuǎn)為矩陣格式

xx_flat, yy_flat, acc_flat, color_flat = xx.ravel(), yy.ravel(), acc.T.ravel(), color_list.ravel() #  #ravel()方法將數(shù)組維度拉成一維數(shù)組

# 畫布
fig = plt.figure()
ax = fig.add_subplot(111, projection="3d")
# 繪制3D柱形圖
ax.bar3d(xx_flat - 0.5, # 中心在刻度線
         yy_flat - 0.5,
         0,
         1, 1, 
         acc_flat,
    color=color_flat,  # 顏色
    edgecolor="black",  # 黑色描邊
    shade=True)  # 加陰影
plt.show()

matplotlib 地圖,python,可視化,matplotlib,matplotlib,3d,數(shù)據(jù)可視化,python


np.meshgrid()函數(shù)的補充

# X, Y = np.meshgrid(x, y) 代表的是將x中每一個數(shù)據(jù)和y中每一個數(shù)據(jù)組合生成很多點,然后將這些點的x坐標(biāo)放入到X中,y坐標(biāo)放入Y中,并且相應(yīng)位置是對應(yīng)的


# 如:
x = [1, 2, 3, 4]
y = [7, 8, 9]
   
# x和y中的每一個元素組合生成
[[[1, 7], [2, 7], [3, 7], [4, 7]],
 [[1, 8], [2, 8], [3, 8], [4, 8]],
 [[1, 9], [2, 9], [3, 9], [4, 9]]]
 
# 然后
# 再分別放入X和Y中
X = [[1, 2, 3, 4],
	 [1, 2, 3, 4],
	 [1, 2, 3, 4]]

Y = [[7, 7, 7, 7],
	 [8, 8, 8, 8],
	 [9, 9, 9, 9],]

# 例子
In [1]: import numpy as np

In [2]: import matplotlib.pyplot as plt

In [3]: x = np.linspace(1, 4, 4)

In [4]: x
Out[4]: array([1., 2., 3., 4.])

In [5]: y = np.linspace(7, 9, 3)

In [6]: y
Out[6]: array([7., 8., 9.])

In [7]: X, Y = np.meshgrid(x, y)

In [8]: X
Out[8]: 
array([[1., 2., 3., 4.],
       [1., 2., 3., 4.],
       [1., 2., 3., 4.]])

In [9]: Y
Out[9]: 
array([[7., 7., 7., 7.],
       [8., 8., 8., 8.],
       [9., 9., 9., 9.]])


使用animation制作動圖

# FuncAnimation類
FuncAnimation(fig, # 表示動畫所在的畫布
              func, # 表示每幀動畫調(diào)用的函數(shù)
              frames, # 表示動畫的長度(一次動畫包含的幀數(shù))
              init_func, # 表示用于開始繪制幀的函數(shù),它會在第一幀動畫之前調(diào)用一次。若未設(shè)置該參數(shù),則程序?qū)⑹褂胒rames序列中第一項的繪圖結(jié)果
              fargs, # 表示傳遞給func函數(shù)的其他參數(shù)
              interval, # 表示更新動畫的頻率,以毫秒為單位,默認(rèn)為200
              blit, # 表示是否更新所有的點,默認(rèn)為False。官方推薦將blit參數(shù)設(shè)為True,但建議macOS用戶將blit參數(shù)設(shè)為False,否則將無法顯示動畫
              )
  • 例子1

  • # 以qt5為圖形界面后端
    %matplotlib qt5
    import numpy as np
    import matplotlib.pyplot as plt
    from matplotlib.animation import FuncAnimation    # 導(dǎo)入動畫FuncAnimation類
    # 數(shù)據(jù)
    x = np.arange(0, 2 * np.pi, 0.01)
    # 畫布
    fig, ax = plt.subplots()
    # 繪圖
    line, = ax.plot(x, np.sin(x))
    # 定義每幀動畫調(diào)用的函數(shù) 
    def animate(i):
        line.set_ydata(np.sin(x + i / 10.0))
        return line
    # 定義初始化幀的函數(shù)
    def init():
        line.set_ydata(np.sin(x))
        return line
    ani = FuncAnimation(fig=fig, # 畫布
                        func=animate, # 每幀動畫調(diào)用的函數(shù)
                        frames=100,  # 一次動畫包含的幀數(shù)
                        init_func=init, # 用于開始繪制幀的函數(shù),它會在第一幀動畫之前調(diào)用一次。
                        interval=20, # 更新動畫的頻率,以毫秒為單位
                        blit=False # 是否更新所有的點,默認(rèn)為False。
                       )
    plt.show()

    matplotlib 地圖,python,可視化,matplotlib,matplotlib,3d,數(shù)據(jù)可視化,python

  • ?例子2

  • # 案例2:點擊鼠標(biāo)左鍵暫停/繼續(xù)動畫
    import numpy as np
    import matplotlib.pyplot as plt
    import matplotlib.animation as animation
    
    
    fig, ax = plt.subplots()
    # 構(gòu)造空線條
    line, = ax.plot([], [])
    # 構(gòu)造線條數(shù)據(jù)
    n = 50
    x = np.arange(n)
    y = np.sin(x)
    # 設(shè)置坐標(biāo)軸刻度范圍
    ax.set_ylim(-1.1, 1.1)
    ax.set_xlim(0, n)
    
    
    # 控制每幀畫面如何繪制
    def update(i):
        line.set_data(x[:i], y[:i])
        return line,
    
    ani = animation.FuncAnimation(fig, update, n, interval=10,)
    
    # 事件處理
    paused = False
    
    def toggle_pause(event):
        global paused
        if paused:
            ani.resume()
        else:
            ani.pause()
        paused = not paused
    
    fig.canvas.mpl_connect('button_press_event', toggle_pause)
    
    plt.show()

    matplotlib 地圖,python,可視化,matplotlib,matplotlib,3d,數(shù)據(jù)可視化,python



使用basemap繪制統(tǒng)計地圖

'''
安裝basemap
cmd窗口命令行安裝
pip install basemap
安裝完成后,在python里輸入以下代碼:
from mpl_toolkits.basemap import Basemap
無報錯,則成功
'''


# 使用basemap
# 以下是常用參數(shù)
Basemap(llcrnrlon=None,llcrnrlat=None, # 表示地圖投影區(qū)域左下角的經(jīng)度或緯度
        urcrnrlon=None,urcrnrlat=None, # 表示地圖投影區(qū)域右上角的經(jīng)度或緯度
        lon_0=None,lat_0=None, # 表示所需地圖投影區(qū)域中心的經(jīng)度或緯度
        width=None,height=None, # 表示所需地圖投影區(qū)域的寬度和高度
        rsphere=None, # 表示投影中使用的球體的半徑
        resolution=None, # 表示包括海岸線、湖泊等的分辨率,可以取值為'c'(粗略。默認(rèn)值)、'l'(低)、'i'(中級)、'h'(高)、'f'(完整)或None。
        # 若要使用shapefile(一種用于存儲地理要素的幾何位置和屬性信息的格式)文件,則可以將resolution參數(shù)設(shè)為None,這種方式無須加載任何數(shù)據(jù),且會極大提高程序的性能
        area_thresh=None, # 表示不會繪制海岸線或湖泊的閾值
        anchor='C', # 表示地圖置于繪圖區(qū)域的方式,默認(rèn)為C,表示地圖居中
        projection='cyl' # 表示地圖投影的類型,默認(rèn)值為cyl
        )

實例:美國部分城鎮(zhèn)人口分布(basemap)

# 03_twinkling_stars_in_3d
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap

plt.rcParams["font.sans-serif"] = ["SimHei"]
plt.rcParams["axes.unicode_minus"] = False
# 創(chuàng)建 Basemap 對象
map = Basemap(projection='stere', # 立體影像投影
              lat_0=90, lon_0=-105, # 地圖投影區(qū)域中心的經(jīng)度或緯度
              llcrnrlat=23.41, llcrnrlon=-118.67, # 地圖投影區(qū)域左下角的經(jīng)度或緯度
              urcrnrlat=45.44, urcrnrlon=-64.52, # 地圖投影區(qū)域右上角的經(jīng)度或緯度
              rsphere=6371200, #  投影中使用的球體的半徑
              resolution='l',  # 表示包括海岸線、湖泊低的分辨率
              area_thresh=10000 # 表示不會繪制海岸線或湖泊的閾值
             )
map.drawmapboundary()     # 繪制地圖投影周圍邊界
map.drawstates()          # 繪制州界
map.drawcoastlines()      # 繪制海岸線
map.drawcountries()       # 繪制國家邊界
# 繪制緯線
parallels = np.arange(0., 90, 10.)
map.drawparallels(parallels, labels=[1, 0, 0, 0], fontsize=10)
# 繪制經(jīng)線
meridians = np.arange(-110., -60., 10.)
map.drawmeridians(meridians, labels=[0, 0, 0, 1], fontsize=10)
# 讀取文件數(shù)據(jù)
posi = pd.read_csv("第七章/2014_us_cities.csv")
# 從3228組城市數(shù)據(jù)中選擇500 組數(shù)據(jù)
lat = np.array(posi["lat"][0:500])               # 獲取緯度值
lon = np.array(posi["lon"][0:500])               # 獲取經(jīng)度值
pop = np.array(posi["pop"][0:500], dtype=float)  # 獲取人口數(shù)
# 氣泡圖的氣泡大小
size = (pop / np.max(pop)) * 1000 
x, y = map(lon, lat)
map.scatter(x, y, s=size)
plt.title('2014年美國部分城鎮(zhèn)的人口分布情況')
plt.show()

matplotlib 地圖,python,可視化,matplotlib,matplotlib,3d,數(shù)據(jù)可視化,python


實例1:三維空間的星星(3D散點圖)

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
plt.rcParams["font.sans-serif"] = ["SimHei"]
plt.rcParams["axes.unicode_minus"] = False
# 生成測試數(shù)據(jù)
x = np.random.randint(0, 40, 30)
y = np.random.randint(0, 40, 30)
z = np.random.randint(0, 40, 30)
# 創(chuàng)建三維坐標(biāo)系的繪圖區(qū)域, 并在該區(qū)域中繪制3D散點圖
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
for xx, yy, zz in zip(x, y, z):
    # 簡單判斷邏輯,給每個范圍的星星賦顏色
    color = 'y'
    if 10 < zz < 20:
        color = '#C71585'
    elif zz >= 20:
        color = '#008B8B'
    ax.scatter(xx, yy, zz, c=color, marker='*',
               s=160,
               linewidth=1, # 線型寬度
               edgecolor='black' # 邊緣顏色
              )
# 設(shè)置軸名稱和標(biāo)題
ax.set_xlabel('x軸')
ax.set_ylabel('y軸')
ax.set_zlabel('z軸')
ax.set_title('3D散點圖', fontproperties='simhei', # 字體樣式
             fontsize=14 # 字體大小
            ) 
plt.tight_layout() # 使圖形更加緊湊
plt.show()

matplotlib 地圖,python,可視化,matplotlib,matplotlib,3d,數(shù)據(jù)可視化,python


實例2:三維空間閃爍的星星(3D動圖)

# 02_twinkling_stars_in_3d
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.animation import FuncAnimation
plt.rcParams["font.sans-serif"] = ["SimHei"]
plt.rcParams["axes.unicode_minus"] = False
# 生成測試數(shù)據(jù)
xx = np.array([13, 5, 25, 13, 9, 19, 3, 39, 13, 27])
yy = np.array([4, 38, 16, 26, 7, 19, 28, 10, 17, 18])
zz = np.array([7, 19, 6, 12, 25, 19, 23, 25, 10, 15])
# 畫布和創(chuàng)建Axes3D對象類
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
# 繪制初始的3D散點圖
star = ax.scatter(xx, yy, zz, # 數(shù)據(jù)
                  c='#C71585', # 顏色
                  marker='*', # 標(biāo)記類型
                  s=160,  # 標(biāo)記大小
                  linewidth=1, # 線型寬度
                  edgecolor='black' # 邊緣顏色
                 )
# 定義每幀動畫調(diào)用的函數(shù)
def animate(i):
    if i % 2:
        color = '#C71585'
    else:
        color = 'white'
    next_star = ax.scatter(xx, yy, zz, c=color, marker='*', s = 160, linewidth=1, edgecolor='black')
    return next_star
# 定義初始化幀的函數(shù)
def init():
    return star # 返回初始的3D散點圖
ani = FuncAnimation(fig=fig, # 畫布
                    func=animate, # 每幀動畫調(diào)用
                    frames=None,  # 一次動畫包含的幀數(shù)
                    init_func =init, # 用于開始繪制幀的函數(shù),它會在第一幀動畫之前調(diào)用一次。
                    interval=1000, # 更新動畫的頻率,以毫秒為單位
                    blit=False # 是否更新所有的點,默認(rèn)為False。
                   )
# 設(shè)置軸名稱和標(biāo)題
ax.set_xlabel('x軸')
ax.set_ylabel('y軸')
ax.set_zlabel('z軸')
ax.set_title('3D散點圖', fontproperties='simhei', fontsize=14)
plt.tight_layout() # 使圖形更加緊湊
plt.show()

matplotlib 地圖,python,可視化,matplotlib,matplotlib,3d,數(shù)據(jù)可視化,python

?


編程題(動點)

import numpy as np 
import matplotlib.pyplot as plt 
import matplotlib.animation as animation # 指定渲染環(huán)境
%matplotlib auto 
# 自動
# 設(shè)置畫布
fig = plt.figure(figsize=(10,6))
# 設(shè)置x,y參數(shù)
x = np.linspace(0, 2*np.pi, 256)
y = np.sin(x)
# 定義方法
def point(self):
    points.set_data(x[self], y[self]) # x[self], y[self] 表示x,y的數(shù)據(jù)
    text.set_text("x=%.3f,y=%.3f"%(x[self], y[self])) # 傳入x,y的數(shù)據(jù),保留三位小數(shù)
    return points, text # Line2D(_line1)  #Text(4, 1, 'x=4.066,y=-0.798')
# 繪制曲線圖
plt.plot(x, y)
# 繪制動點
points,= plt.plot(x[0], y[0], # 初始點
                  "or"
                  )
text = plt.text(4, 1, # 文本注釋位置
                '',
                fontsize=14
               ) # 添加文本注釋
ani = animation.FuncAnimation(fig, # 畫布
                              point, 
                              np.arange(0, 256),
                              interval=100, # 更新動畫的頻率,以毫秒為單位
                              blit=True # 是否更新所有的點,默認(rèn)為False。
                             )
plt.show()

matplotlib 地圖,python,可視化,matplotlib,matplotlib,3d,數(shù)據(jù)可視化,python


總結(jié)

本文主要使用matplotlib相關(guān)庫繪制3D圖表和統(tǒng)計地圖,以望多加練習(xí)!文章來源地址http://www.zghlxwxcb.cn/news/detail-758135.html

到了這里,關(guān)于使用matplotlib繪制3D圖表和統(tǒng)計地圖的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • 【100天精通Python】Day65:Python可視化_Matplotlib3D繪圖mplot3d,繪制3D散點圖、3D線圖和3D條形圖,示例+代碼

    ??mpl_toolkits.mplot3d 是 Matplotlib 庫中的一個子模塊,用于繪制和可視化三維圖形,包括三維散點圖、曲面圖、線圖等。它提供了豐富的功能來創(chuàng)建和定制三維圖形。以下是 mpl_toolkits.mplot3d 的主要功能和功能簡介: 3D 散點圖 :通過 scatter 函數(shù),你可以繪制三維散點圖,用于顯示

    2024年02月07日
    瀏覽(30)
  • 第五章. 可視化數(shù)據(jù)分析圖表—常用圖表的繪制4—箱形圖,3D圖表

    第五章. 可視化數(shù)據(jù)分析圖表—常用圖表的繪制4—箱形圖,3D圖表

    第五章. 可視化數(shù)據(jù)分析圖 本節(jié)主要介紹常用圖表的繪制,主要包括箱形圖,3D柱形圖,3D曲面圖。 ·箱形圖又稱箱線圖、盒須圖或盒式圖 ·用于顯示一組數(shù)據(jù)分散情況的統(tǒng)計圖 ·優(yōu)點:不受異常值的影響,可以以一種相對穩(wěn)定的方式描述數(shù)據(jù)的離散分布情況,也常用于異常值

    2024年02月03日
    瀏覽(40)
  • Python 數(shù)據(jù)可視化教程 - 如何使用 pyecharts 繪制多條折線圖表

    部分?jǐn)?shù)據(jù)來源: ChatGPT?? 引言 ????????本文主要介紹如何使用 Python 中的 pyecharts 庫,繪制多條折線圖表。在本例中,我們將展示各國的 COVID-19 確診人數(shù)數(shù)據(jù)。 1、首先,我們需要導(dǎo)入必要的庫: 其中, json ?庫用于解析 JSON 數(shù)據(jù), pyecharts ?庫用于繪圖, TitleOpts 、 Lege

    2024年02月09日
    瀏覽(31)
  • [數(shù)據(jù)分析與可視化] Python繪制數(shù)據(jù)地圖3-GeoPandas使用要點

    [數(shù)據(jù)分析與可視化] Python繪制數(shù)據(jù)地圖3-GeoPandas使用要點

    本文主要介紹GeoPandas的使用要點。GeoPandas是一個Python開源項目,旨在提供豐富而簡單的地理空間數(shù)據(jù)處理接口。GeoPandas擴展了Pandas的數(shù)據(jù)類型,并使用matplotlib進行繪圖。GeoPandas官方倉庫地址為:GeoPandas。GeoPandas的官方文檔地址為:GeoPandas-doc。本文主要參考GeoPandas Examples Gal

    2024年02月09日
    瀏覽(30)
  • 使用Apache ECharts同時繪制多個統(tǒng)計圖表

    使用Apache ECharts同時繪制多個統(tǒng)計圖表

    目錄 1、介紹 2、相關(guān)知識 3、代碼 4、效果 ??作者介紹:雙非本科大三網(wǎng)絡(luò)工程專業(yè)在讀,阿里云專家博主,專注于Java領(lǐng)域?qū)W習(xí),擅長web應(yīng)用開發(fā)、數(shù)據(jù)結(jié)構(gòu)和算法,初步涉獵Python人工智能開發(fā)和前端開發(fā)。 ??主頁:@逐夢蒼穹 ??所屬專欄:前端 ??您的一鍵三連,是我創(chuàng)

    2024年02月21日
    瀏覽(29)
  • 【Python入門系列】第十五篇:Python數(shù)據(jù)可視化和圖表繪制

    數(shù)據(jù)可視化是數(shù)據(jù)分析和數(shù)據(jù)科學(xué)中非常重要的一部分。通過可視化,我們可以更好地理解數(shù)據(jù)、發(fā)現(xiàn)數(shù)據(jù)之間的關(guān)系、展示數(shù)據(jù)的趨勢和模式,并向他人傳達我們的發(fā)現(xiàn)。 Python是一種功能強大的編程語言,擁有許多用于數(shù)據(jù)可視化的庫和工具。其中,Matplotlib是最常用的繪

    2024年02月13日
    瀏覽(27)
  • 用Python繪制六種可視化圖表,簡直太好用了

    用Python繪制六種可視化圖表,簡直太好用了

    前言 嗨嘍~大家好呀,這里是魔王吶 ? ~! python資料、源碼、教程: 點擊此處跳轉(zhuǎn)文末名片獲取 可視化圖表,有相當(dāng)多種,但常見的也就下面幾種,其他比較復(fù)雜一點,大都也是基于如下幾種進行組合,變換出來的。 對于初學(xué)者來說,很容易被這官網(wǎng)上眾多的圖表類型給嚇著

    2024年02月10日
    瀏覽(99)
  • Python可視化神器:pyecharts,輕松繪制 30+ 種超實用精美圖表!

    Python可視化神器:pyecharts,輕松繪制 30+ 種超實用精美圖表!

    歡迎關(guān)注 ,專注 Python、數(shù)據(jù)分析、數(shù)據(jù)挖掘、好玩工具! 如果要問:Python 中有那些可視化工具庫?我想很多人都能想起來 matplotlib,這是一款初學(xué)者繞不開的庫,但隨著對數(shù)據(jù)可視化的要求越來越高,matplotlib 已無法滿足了。 今天我將和大家詳細(xì)講解 Pyecharts 模塊,說到它

    2023年04月08日
    瀏覽(28)
  • 基于Python的疫情數(shù)據(jù)可視化(matplotlib,pyecharts動態(tài)地圖,大屏可視化)

    基于Python的疫情數(shù)據(jù)可視化(matplotlib,pyecharts動態(tài)地圖,大屏可視化)

    有任何學(xué)習(xí)問題可以加我微信交流哦!bmt1014 1、項目需求分析 1.1背景 2020年,新冠肺炎疫情在全球范圍內(nèi)爆發(fā),給人們的健康和生命帶來了嚴(yán)重威脅,不同國家和地區(qū)的疫情形勢也引起了廣泛的關(guān)注。疫情數(shù)據(jù)的監(jiān)測和分析對疫情防控和科學(xué)防治至關(guān)重要。本報告以疫情數(shù)據(jù)

    2024年02月05日
    瀏覽(41)
  • Python - Matplotlib 繪制 3D 圣誕樹

    Python - Matplotlib 繪制 3D 圣誕樹

    ? 前言 轉(zhuǎn)自: How to draw a 3D Christmas Tree with Matplotlib | by Timur Bakibayev, Ph.D. | Analytics Vidhya | Medium https://medium.com/analytics-vidhya/how-to-draw-a-3d-christmas-tree-with-matplotlib-aabb9bc27864 因為我們把圣誕樹安裝在暖氣電池旁邊,所以它很快就死了。所以我決定用 Matplotlib 繪制一棵圣誕樹。你不

    2024年01月21日
    瀏覽(102)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包