当前位置: 首页 > news >正文

python画气泡标尺图

目录

  • 渐变气泡图
  • 彩色气泡图

在进行实验结果分析的时候,气泡标尺图能非常清晰对不同的结果进行多维度的比较,特别是在深度学习模型大小和精度进行比较的时候非常合适使用,以下是几个例子。

渐变气泡图

import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pddata = pd.DataFrame({'Model Size (MB)': [251, 218, 261, 280, 221],'Accuracy': [0.85, 0.88, 0.87, 0.91, 0.83],'Model Name': ['Resnet', 'Unet', 'Googlenet', 'Deeplabv3', 'Pspnet']
})# Create a bubble plot with larger circle sizes for different accuracies and a different colormap
plt.figure(figsize=(10, 6))
plot = sns.scatterplot(data=data, x='Model Size (MB)', y='Accuracy', size='Accuracy', hue='Accuracy', sizes=(100, 1000), cmap='viridis')
plt.title('Bubble Plot of Model Size vs. Accuracy in Deep Learning')
plt.xlabel('Model Size (MB)')
plt.ylabel('Accuracy')# Customize the legend and move it inside the plot to the upper left corner
plt.legend(title='Accuracy')
plt.gca().legend(loc='upper left', bbox_to_anchor=(0.02, 0.98))# Add model names near the circles
for line in range(0, data.shape[0]):plot.text(data['Model Size (MB)'][line], data['Accuracy'][line], data['Model Name'][line], horizontalalignment='left', size='medium', color='black', weight='semibold')# Adjust X-axis tick spacing
plt.xticks([200, 220, 240, 260, 280, 300])plt.show()

示例图:
请添加图片描述

彩色气泡图

import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pddata = pd.DataFrame({'Model Size (MB)': [251, 218, 261, 280, 221],'Accuracy': [0.85, 0.88, 0.87, 0.91, 0.83],'Model Name': ['Resnet', 'Unet', 'Googlenet', 'Deeplabv3', 'Pspnet']
})# Define a bright and colorful color palette
bright_palette = sns.color_palette("husl", as_cmap=True)# Create a bubble plot with larger circle sizes for different accuracies and the defined color palette
plt.figure(figsize=(10, 6))
plot = sns.scatterplot(data=data, x='Model Size (MB)', y='Accuracy', size='Accuracy', hue='Accuracy', sizes=(100, 1000), palette=bright_palette)
plt.title('Bubble Plot of Model Size vs. Accuracy in Deep Learning')
plt.xlabel('Model Size (MB)')
plt.ylabel('Accuracy')# Customize the legend and move it inside the plot to the upper left corner
plt.legend(title='Accuracy')
plt.gca().legend(loc='upper left', bbox_to_anchor=(0.02, 0.98))# Add model names near the circles
for line in range(0, data.shape[0]):plot.text(data['Model Size (MB)'][line], data['Accuracy'][line], data['Model Name'][line], horizontalalignment='left', size='medium', color='black', weight='semibold')# Adjust X-axis tick spacing
plt.xticks([200, 220, 240, 260, 280, 300])plt.show()

示例图:
请添加图片描述

http://www.lryc.cn/news/209082.html

相关文章:

  • Java并发编程指南:如何正确使用信号量和线程池熔断机制
  • 大彩串口屏读写文件问题
  • php之 角色的权限管理(RBAC)详解
  • asp.net乡村旅游管理系统VS开发sqlserver数据库web结构c#编程Microsoft Visual Studio
  • 【linux】文件系统+软硬连接+动静态库
  • 力扣每日一题73:矩阵置零
  • vscode C++项目相对路径的问题
  • 视频转换器WinX HD Video Converter mac中文特点介绍
  • 数据隐私保护的方法有哪些?
  • 【Linux】解决缓存锁问题:无法获得锁 /var/lib/dpkg/lock-frontend
  • 嵌入式软件开发工程师应该关注芯片数据手册中的哪些信息
  • 基于数字电路交通灯信号灯控制系统设计-单片机设计
  • Spring Boot 配置邮件发送服务
  • 【Spring】快速入门Spring Web MVC
  • python---continue关键字对for...else结构的影响
  • 小结笔记:多位管理大师关于管理的要素的论述
  • sql---慢查询和语句耗时
  • ChinaSoft 论坛巡礼 | 智慧化 IDE 论坛
  • 数字孪生智慧工厂三维可视化系统解决方案,打造新一代智慧工厂
  • 并查集学习心得
  • 自动驾驶之—LaneAF学习相关总结
  • 软考系统架构之案例篇(Redis相关概念)
  • 黑客入门指南,学习黑客必须掌握的技术
  • 定档11月2日,YashanDB 2023年度发布会完整议程公布
  • composer安装thinkphp6报错
  • 此页面不能正确地重定向
  • 【Apache Flink】实现有状态函数
  • Android原生项目集成uniMPSDK(Uniapp)遇到的报错总结
  • Linux redis 安装
  • 在Win11上部署ChatGLM3详细步骤