中文字幕理论片,69视频免费在线观看,亚洲成人app,国产1级毛片,刘涛最大尺度戏视频,欧美亚洲美女视频,2021韩国美女仙女屋vip视频

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
SCI常見的18種配圖代碼實(shí)現(xiàn)
  1.  折線圖

import matplotlib.pyplot as pltimport seaborn as snsimport numpy as np
# 設(shè)置風(fēng)格sns.set(style='whitegrid')
# 生成數(shù)據(jù)x = np.linspace(0, 10, 100)y1 = np.sin(x)y2 = np.cos(x)
# 創(chuàng)建圖表plt.figure(figsize=(10, 6))plt.plot(x, y1, label='Sine Wave', color='b', linewidth=2)plt.plot(x, y2, label='Cosine Wave', color='r', linestyle='--', linewidth=2)
# 添加裝飾plt.fill_between(x, y1, y2, color='gray', alpha=0.1)plt.title('Line Plot', fontsize=15)plt.xlabel('X-axis', fontsize=12)plt.ylabel('Y-axis', fontsize=12)plt.legend()plt.show()

2. 散點(diǎn)圖

import matplotlib.pyplot as pltimport seaborn as snsimport numpy as np
# 設(shè)置風(fēng)格sns.set(style='whitegrid')
# 生成數(shù)據(jù)x = np.random.rand(100)y = np.random.rand(100)colors = np.random.rand(100)sizes = 1000 * np.random.rand(100)
# 創(chuàng)建圖表plt.figure(figsize=(10, 6))plt.scatter(x, y, c=colors, s=sizes, alpha=0.5, cmap='viridis')plt.colorbar()
# 添加裝飾plt.title('Scatter Plot', fontsize=15)plt.xlabel('X-axis', fontsize=12)plt.ylabel('Y-axis', fontsize=12)plt.show()

3. 條形圖

import matplotlib.pyplot as pltimport seaborn as sns
# 設(shè)置風(fēng)格sns.set(style='whitegrid')
# 生成數(shù)據(jù)categories = ['A', 'B', 'C', 'D']values1 = [5, 7, 8, 6]values2 = [3, 4, 5, 2]
# 創(chuàng)建圖表fig, ax = plt.subplots(figsize=(10, 6))bar1 = ax.bar(categories, values1, label='Group 1')bar2 = ax.bar(categories, values2, bottom=values1, label='Group 2')
# 添加裝飾ax.set_title('Stacked Bar Chart', fontsize=15)ax.set_xlabel('Categories', fontsize=12)ax.set_ylabel('Values', fontsize=12)ax.legend()
# 添加數(shù)值標(biāo)簽for rect in bar1 + bar2: height = rect.get_height() ax.annotate(f'{height}', xy=(rect.get_x() + rect.get_width() / 2, height), xytext=(0, 3), textcoords='offset points', ha='center', va='bottom')
plt.show()

4. 熱力圖

import matplotlib.pyplot as pltimport seaborn as snsimport numpy as np
# 生成數(shù)據(jù)data = np.random.rand(10, 12)
# 創(chuàng)建熱圖plt.figure(figsize=(10, 6))sns.heatmap(data, annot=True, fmt='.2f', cmap='coolwarm')
# 添加裝飾plt.title('Heatmap', fontsize=15)plt.show()

5. 箱線圖

import matplotlib.pyplot as pltimport seaborn as snsimport numpy as np
# 設(shè)置風(fēng)格sns.set(style='whitegrid')
# 生成數(shù)據(jù)data = np.random.normal(size=(20, 6)) + np.arange(6) / 2
# 創(chuàng)建圖表plt.figure(figsize=(10, 6))sns.boxplot(data=data, palette='vlag')
# 添加裝飾plt.title('Box Plot', fontsize=15)plt.show()

6. 蜘蛛圖

import numpy as npimport matplotlib.pyplot as pltimport seaborn as sns
# 設(shè)置風(fēng)格sns.set(style='whitegrid')
# 數(shù)據(jù)準(zhǔn)備labels = np.array(['A', 'B', 'C', 'D', 'E'])stats = [10, 20, 30, 40, 50]stats2 = [30, 10, 20, 30, 40]
# 創(chuàng)建蜘蛛圖angles = np.linspace(0, 2 * np.pi, len(labels), endpoint=False).tolist()stats = np.concatenate((stats, [stats[0]]))stats2 = np.concatenate((stats2, [stats2[0]]))angles += angles[:1]
fig, ax = plt.subplots(figsize=(8, 8), subplot_kw=dict(polar=True))ax.fill(angles, stats, color='blue', alpha=0.25, label='Group 1')ax.plot(angles, stats, color='blue', linewidth=2)ax.fill(angles, stats2, color='red', alpha=0.25, label='Group 2')ax.plot(angles, stats2, color='red', linewidth=2)ax.set_yticklabels([])ax.set_xticks(angles[:-1])ax.set_xticklabels(labels, fontsize=12)ax.grid(True)
# 添加標(biāo)題和圖例plt.title('Enhanced Spider Chart', size=20, color='black', y=1.1)plt.legend(loc='upper right', bbox_to_anchor=(0.1, 0.1))plt.show()

7. 雙軸圖

import matplotlib.pyplot as pltimport seaborn as snsimport numpy as np
# 設(shè)置風(fēng)格sns.set(style='whitegrid')
# 生成數(shù)據(jù)x = np.linspace(0, 10, 100)y1 = np.sin(x)y2 = np.cos(x)
# 創(chuàng)建圖表fig, ax1 = plt.subplots(figsize=(10, 6))
ax2 = ax1.twinx()ax1.plot(x, y1, 'g-')ax2.plot(x, y2, 'b-')
# 添加裝飾ax1.set_xlabel('X-axis')ax1.set_ylabel('Sine', color='g')ax2.set_ylabel('Cosine', color='b')plt.title('Dual Axis Plot')plt.show()

8. 面積圖

import matplotlib.pyplot as pltimport seaborn as snsimport numpy as np
# 設(shè)置風(fēng)格sns.set(style='whitegrid')
# 生成數(shù)據(jù)x = np.linspace(0, 10, 100)y1 = np.sin(x)y2 = np.cos(x)
# 創(chuàng)建圖表plt.figure(figsize=(10, 6))plt.fill_between(x, y1, color='skyblue', alpha=0.4)plt.fill_between(x, y2, color='orange', alpha=0.4)
# 添加裝飾plt.title('Area Chart', fontsize=15)plt.xlabel('X-axis', fontsize=12)plt.ylabel('Y-axis', fontsize=12)plt.show()

9. 帶狀圖

import matplotlib.pyplot as pltimport seaborn as snsimport numpy as np
# 設(shè)置風(fēng)格sns.set(style='whitegrid')
# 生成數(shù)據(jù)x = np.linspace(0, 10, 100)y = np.sin(x)z = np.sin(x) + np.random.normal(0, 0.1, 100)
# 創(chuàng)建圖表plt.figure(figsize=(10, 6))plt.plot(x, y, label='Sine Wave')plt.fill_between(x, y, z, where=(y >= z), interpolate=True, color='green', alpha=0.3)plt.fill_between(x, y, z, where=(y < z), interpolate=True, color='red', alpha=0.3)
# 添加裝飾plt.title('Band Chart', fontsize=15)plt.xlabel('X-axis', fontsize=12)plt.ylabel('Y-axis', fontsize=12)plt.legend()plt.show()

10. 等高線圖

import numpy as npimport matplotlib.pyplot as pltimport seaborn as sns
# 設(shè)置風(fēng)格sns.set(style='white')
# 數(shù)據(jù)準(zhǔn)備x = np.linspace(-5, 5, 50)y = np.linspace(-5, 5, 50)X, Y = np.meshgrid(x, y)Z = np.sin(np.sqrt(X**2 + Y**2))
# 創(chuàng)建等高線圖plt.figure(figsize=(10, 6))contour = plt.contourf(X, Y, Z, cmap='coolwarm', levels=20)plt.colorbar(contour)
# 添加裝飾plt.title('Contour Plot', fontsize=15)plt.show()

11. 極坐標(biāo)圖

import numpy as npimport matplotlib.pyplot as pltimport seaborn as sns
# 設(shè)置風(fēng)格sns.set(style='white')
# 數(shù)據(jù)準(zhǔn)備theta = np.linspace(0, 2*np.pi, 100)r = np.abs(np.sin(theta) * np.cos(theta))
# 創(chuàng)建極坐標(biāo)圖plt.figure(figsize=(8, 8))ax = plt.subplot(111, polar=True)ax.plot(theta, r, color='b', linewidth=2)
# 添加裝飾plt.title('Polar Plot', fontsize=15)plt.show()

12. 3D曲面圖

import numpy as npimport matplotlib.pyplot as pltfrom mpl_toolkits.mplot3d import Axes3Dimport seaborn as sns
# 設(shè)置風(fēng)格sns.set(style='white')
# 數(shù)據(jù)準(zhǔn)備x = np.linspace(-5, 5, 50)y = np.linspace(-5, 5, 50)X, Y = np.meshgrid(x, y)Z = np.sin(np.sqrt(X**2 + Y**2))
# 創(chuàng)建3D曲面圖fig = plt.figure(figsize=(10, 6))ax = fig.add_subplot(111, projection='3d')surf = ax.plot_surface(X, Y, Z, cmap='viridis')fig.colorbar(surf)
# 添加裝飾plt.title('3D Surface Plot', fontsize=15)plt.show()

13. 3D散點(diǎn)圖

import numpy as npimport matplotlib.pyplot as pltfrom mpl_toolkits.mplot3d import Axes3Dimport seaborn as sns
# 設(shè)置風(fēng)格sns.set(style='white')
# 數(shù)據(jù)準(zhǔn)備x = np.random.standard_normal(100)y = np.random.standard_normal(100)z = np.random.standard_normal(100)
# 創(chuàng)建3D散點(diǎn)圖fig = plt.figure(figsize=(10, 6))ax = fig.add_subplot(111, projection='3d')scatter = ax.scatter(x, y, z, c=z, cmap='viridis')
# 添加裝飾fig.colorbar(scatter)plt.title('3D Scatter Plot', fontsize=15)plt.show()

14. 3D條形圖

import numpy as npimport matplotlib.pyplot as pltfrom mpl_toolkits.mplot3d import Axes3Dimport seaborn as sns
# 設(shè)置風(fēng)格sns.set(style='white')
# 數(shù)據(jù)準(zhǔn)備x = np.arange(1, 11)y = np.random.randint(1, 10, 10)z = np.zeros(10)
# 創(chuàng)建3D條形圖fig = plt.figure(figsize=(10, 6))ax = fig.add_subplot(111, projection='3d')bars = ax.bar3d(x, y, z, 1, 1, y, shade=True)
# 添加裝飾plt.title('3D Bar Plot', fontsize=15)plt.show()

15. 直方圖

import matplotlib.pyplot as pltimport seaborn as snsimport numpy as np
# 設(shè)置風(fēng)格sns.set(style='whitegrid')
# 生成數(shù)據(jù)data = np.random.randn(1000)
# 創(chuàng)建圖表plt.figure(figsize=(10, 6))sns.histplot(data, kde=True, color='purple', bins=30)
# 添加裝飾plt.title('Histogram', fontsize=15)plt.xlabel('Value', fontsize=12)plt.ylabel('Frequency', fontsize=12)plt.show()

16.小提琴圖

import matplotlib.pyplot as pltimport seaborn as snsimport numpy as np
# 設(shè)置風(fēng)格sns.set(style='whitegrid')
# 生成數(shù)據(jù)data = np.random.normal(size=(20, 6)) + np.arange(6) / 2
# 創(chuàng)建圖表plt.figure(figsize=(10, 6))sns.violinplot(data=data, palette='muted')
# 添加裝飾plt.title('Violin Plot', fontsize=15)plt.show()

17.成對關(guān)系圖

import seaborn as snsimport matplotlib.pyplot as plt
# 生成數(shù)據(jù)iris = sns.load_dataset('iris')
# 創(chuàng)建圖表sns.pairplot(iris, hue='species', palette='muted')plt.suptitle('Pair Plot', y=1.02, fontsize=15)plt.show()

18. Facet Grid 圖

import seaborn as snsimport matplotlib.pyplot as plt
# 生成數(shù)據(jù)tips = sns.load_dataset('tips')
# 創(chuàng)建圖表g = sns.FacetGrid(tips, col='time', row='smoker', margin_titles=True)g.map(sns.scatterplot, 'total_bill', 'tip', alpha=.7)g.add_legend()
# 添加裝飾plt.suptitle('Facet Grid', y=1.02, fontsize=15)plt.show()

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
Seaborn常用的10種數(shù)據(jù)分析圖表
Python繪圖庫之Seaborn(四)
機(jī)器學(xué)習(xí)中的概率論與梳理統(tǒng)計(jì)(Python實(shí)現(xiàn)數(shù)學(xué)期望、方差等)
python繪制三維圖
Python 數(shù)據(jù)可視化,常用看這一篇就夠了
我用數(shù)據(jù)告訴你,家長學(xué)歷對孩子成績的影響有多大?
更多類似文章 >>
生活服務(wù)
熱點(diǎn)新聞
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服