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

pycharm制作柱状图

 Bar - Bar_rotate_xaxis_label

解决标签名字过长的问题

from pyecharts import options as opts
from pyecharts.charts import Barc = (Bar().add_xaxis(["高等数学1,2","C语言程序设计","python程序设计","大数据导论","数据结构","大数据与人工智能",]).add_yaxis("大一的学习效率", [10, 20, 30, 40, 50, 40]).add_yaxis("大二的学习效率", [20, 10, 40, 30, 40, 50]).set_global_opts(xaxis_opts=opts.AxisOpts(axislabel_opts=opts.LabelOpts(rotate=-15)),   #此行代码旋转标签的角度title_opts=opts.TitleOpts(title="信阳农林学院信息工程学院", subtitle="数据科学与大数据技术21-2"),).render("bar_rotate_xaxis_label.html")
)
<!DOCTYPE html>
<html>
<head><meta charset="UTF-8"><title>Awesome-pyecharts</title><script type="text/javascript" src="https://assets.pyecharts.org/assets/v5/echarts.min.js"></script></head>
<body ><div id="8601599b79914f0cb28546e9b9a362e3" class="chart-container" style="width:900px; height:500px; "></div><script>var chart_8601599b79914f0cb28546e9b9a362e3 = echarts.init(document.getElementById('8601599b79914f0cb28546e9b9a362e3'), 'white', {renderer: 'canvas'});var option_8601599b79914f0cb28546e9b9a362e3 = {"animation": true,"animationThreshold": 2000,"animationDuration": 1000,"animationEasing": "cubicOut","animationDelay": 0,"animationDurationUpdate": 300,"animationEasingUpdate": "cubicOut","animationDelayUpdate": 0,"aria": {"enabled": false},"color": ["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc"],"series": [{"type": "bar","name": "\u5927\u4e00\u7684\u5b66\u4e60\u6548\u7387","legendHoverLink": true,"data": [10,20,30,40,50,40],"realtimeSort": false,"showBackground": false,"stackStrategy": "samesign","cursor": "pointer","barMinHeight": 0,"barCategoryGap": "20%","barGap": "30%","large": false,"largeThreshold": 400,"seriesLayoutBy": "column","datasetIndex": 0,"clip": true,"zlevel": 0,"z": 2,"label": {"show": true,"margin": 8}},{"type": "bar","name": "\u5927\u4e8c\u7684\u5b66\u4e60\u6548\u7387","legendHoverLink": true,"data": [20,10,40,30,40,50],"realtimeSort": false,"showBackground": false,"stackStrategy": "samesign","cursor": "pointer","barMinHeight": 0,"barCategoryGap": "20%","barGap": "30%","large": false,"largeThreshold": 400,"seriesLayoutBy": "column","datasetIndex": 0,"clip": true,"zlevel": 0,"z": 2,"label": {"show": true,"margin": 8}}],"legend": [{"data": ["\u5927\u4e00\u7684\u5b66\u4e60\u6548\u7387","\u5927\u4e8c\u7684\u5b66\u4e60\u6548\u7387"],"selected": {},"show": true,"padding": 5,"itemGap": 10,"itemWidth": 25,"itemHeight": 14,"backgroundColor": "transparent","borderColor": "#ccc","borderWidth": 1,"borderRadius": 0,"pageButtonItemGap": 5,"pageButtonPosition": "end","pageFormatter": "{current}/{total}","pageIconColor": "#2f4554","pageIconInactiveColor": "#aaa","pageIconSize": 15,"animationDurationUpdate": 800,"selector": false,"selectorPosition": "auto","selectorItemGap": 7,"selectorButtonGap": 10}],"tooltip": {"show": true,"trigger": "item","triggerOn": "mousemove|click","axisPointer": {"type": "line"},"showContent": true,"alwaysShowContent": false,"showDelay": 0,"hideDelay": 100,"enterable": false,"confine": false,"appendToBody": false,"transitionDuration": 0.4,"textStyle": {"fontSize": 14},"borderWidth": 0,"padding": 5,"order": "seriesAsc"},"xAxis": [{"show": true,"scale": false,"nameLocation": "end","nameGap": 15,"gridIndex": 0,"axisLabel": {"show": true,"rotate": -15,"margin": 8},"inverse": false,"offset": 0,"splitNumber": 5,"minInterval": 0,"splitLine": {"show": true,"lineStyle": {"show": true,"width": 1,"opacity": 1,"curveness": 0,"type": "solid"}},"data": ["\u9ad8\u7b49\u6570\u5b661\uff0c2","C\u8bed\u8a00\u7a0b\u5e8f\u8bbe\u8ba1","python\u7a0b\u5e8f\u8bbe\u8ba1","\u5927\u6570\u636e\u5bfc\u8bba","\u6570\u636e\u7ed3\u6784","\u5927\u6570\u636e\u4e0e\u4eba\u5de5\u667a\u80fd"]}],"yAxis": [{"show": true,"scale": false,"nameLocation": "end","nameGap": 15,"gridIndex": 0,"inverse": false,"offset": 0,"splitNumber": 5,"minInterval": 0,"splitLine": {"show": true,"lineStyle": {"show": true,"width": 1,"opacity": 1,"curveness": 0,"type": "solid"}}}],"title": [{"show": true,"text": "\u4fe1\u9633\u519c\u6797\u5b66\u9662\u4fe1\u606f\u5de5\u7a0b\u5b66\u9662","target": "blank","subtext": "\u6570\u636e\u79d1\u5b66\u4e0e\u5927\u6570\u636e\u6280\u672f21-2","subtarget": "blank","padding": 5,"itemGap": 10,"textAlign": "auto","textVerticalAlign": "auto","triggerEvent": false}]
};chart_8601599b79914f0cb28546e9b9a362e3.setOption(option_8601599b79914f0cb28546e9b9a362e3);</script>
</body>
</html>

 

 Bar - Bar_stack0

叠层柱状图

可以求比例

from pyecharts import options as opts
from pyecharts.charts import Bar
from pyecharts.faker import Fakerc = (Bar().add_xaxis(["高等数学1,2","C语言程序设计","python程序设计","大数据导论","数据结构","大数据与人工智能",]).add_yaxis("大一的学习效率", [10, 20, 30, 40, 50, 40],stack="stack1")  # stack="stack1" 表示同一列.add_yaxis("大二的学习效率", [20, 30, 50, 60, 70, 80],stack="stack1")  #.set_series_opts(label_opts=opts.LabelOpts(is_show=False)).set_global_opts(xaxis_opts=opts.AxisOpts(axislabel_opts=opts.LabelOpts(rotate=-15)),title_opts=opts.TitleOpts(title="信息工程学院学习知识所占百分比")).render("bar_stack0.html")
)
<!DOCTYPE html>
<html>
<head><meta charset="UTF-8"><title>Awesome-pyecharts</title><script type="text/javascript" src="https://assets.pyecharts.org/assets/v5/echarts.min.js"></script></head>
<body ><div id="ef493756d92b45dcb840f2c58c5f385f" class="chart-container" style="width:900px; height:500px; "></div><script>var chart_ef493756d92b45dcb840f2c58c5f385f = echarts.init(document.getElementById('ef493756d92b45dcb840f2c58c5f385f'), 'white', {renderer: 'canvas'});var option_ef493756d92b45dcb840f2c58c5f385f = {"animation": true,"animationThreshold": 2000,"animationDuration": 1000,"animationEasing": "cubicOut","animationDelay": 0,"animationDurationUpdate": 300,"animationEasingUpdate": "cubicOut","animationDelayUpdate": 0,"aria": {"enabled": false},"color": ["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc"],"series": [{"type": "bar","name": "\u5927\u4e00\u7684\u5b66\u4e60\u6548\u7387","legendHoverLink": true,"data": [10,20,30,40,50,40],"realtimeSort": false,"showBackground": false,"stack": "stack1","stackStrategy": "samesign","cursor": "pointer","barMinHeight": 0,"barCategoryGap": "20%","barGap": "30%","large": false,"largeThreshold": 400,"seriesLayoutBy": "column","datasetIndex": 0,"clip": true,"zlevel": 0,"z": 2,"label": {"show": false,"margin": 8},"rippleEffect": {"show": true,"brushType": "stroke","scale": 2.5,"period": 4}},{"type": "bar","name": "\u5927\u4e8c\u7684\u5b66\u4e60\u6548\u7387","legendHoverLink": true,"data": [20,30,50,60,70,80],"realtimeSort": false,"showBackground": false,"stack": "stack1","stackStrategy": "samesign","cursor": "pointer","barMinHeight": 0,"barCategoryGap": "20%","barGap": "30%","large": false,"largeThreshold": 400,"seriesLayoutBy": "column","datasetIndex": 0,"clip": true,"zlevel": 0,"z": 2,"label": {"show": false,"margin": 8},"rippleEffect": {"show": true,"brushType": "stroke","scale": 2.5,"period": 4}}],"legend": [{"data": ["\u5927\u4e00\u7684\u5b66\u4e60\u6548\u7387","\u5927\u4e8c\u7684\u5b66\u4e60\u6548\u7387"],"selected": {},"show": true,"padding": 5,"itemGap": 10,"itemWidth": 25,"itemHeight": 14,"backgroundColor": "transparent","borderColor": "#ccc","borderWidth": 1,"borderRadius": 0,"pageButtonItemGap": 5,"pageButtonPosition": "end","pageFormatter": "{current}/{total}","pageIconColor": "#2f4554","pageIconInactiveColor": "#aaa","pageIconSize": 15,"animationDurationUpdate": 800,"selector": false,"selectorPosition": "auto","selectorItemGap": 7,"selectorButtonGap": 10}],"tooltip": {"show": true,"trigger": "item","triggerOn": "mousemove|click","axisPointer": {"type": "line"},"showContent": true,"alwaysShowContent": false,"showDelay": 0,"hideDelay": 100,"enterable": false,"confine": false,"appendToBody": false,"transitionDuration": 0.4,"textStyle": {"fontSize": 14},"borderWidth": 0,"padding": 5,"order": "seriesAsc"},"xAxis": [{"show": true,"scale": false,"nameLocation": "end","nameGap": 15,"gridIndex": 0,"axisLabel": {"show": true,"rotate": -15,"margin": 8},"inverse": false,"offset": 0,"splitNumber": 5,"minInterval": 0,"splitLine": {"show": true,"lineStyle": {"show": true,"width": 1,"opacity": 1,"curveness": 0,"type": "solid"}},"data": ["\u9ad8\u7b49\u6570\u5b661\uff0c2","C\u8bed\u8a00\u7a0b\u5e8f\u8bbe\u8ba1","python\u7a0b\u5e8f\u8bbe\u8ba1","\u5927\u6570\u636e\u5bfc\u8bba","\u6570\u636e\u7ed3\u6784","\u5927\u6570\u636e\u4e0e\u4eba\u5de5\u667a\u80fd"]}],"yAxis": [{"show": true,"scale": false,"nameLocation": "end","nameGap": 15,"gridIndex": 0,"inverse": false,"offset": 0,"splitNumber": 5,"minInterval": 0,"splitLine": {"show": true,"lineStyle": {"show": true,"width": 1,"opacity": 1,"curveness": 0,"type": "solid"}}}],"title": [{"show": true,"text": "\u4fe1\u606f\u5de5\u7a0b\u5b66\u9662\u5b66\u4e60\u77e5\u8bc6\u6240\u5360\u767e\u5206\u6bd4","target": "blank","subtarget": "blank","padding": 5,"itemGap": 10,"textAlign": "auto","textVerticalAlign": "auto","triggerEvent": false}]
};chart_ef493756d92b45dcb840f2c58c5f385f.setOption(option_ef493756d92b45dcb840f2c58c5f385f);</script>
</body>
</html>

 

相关文章:

pycharm制作柱状图

Bar - Bar_rotate_xaxis_label 解决标签名字过长的问题 from pyecharts import options as opts from pyecharts.charts import Barc (Bar().add_xaxis(["高等数学1&#xff0c;2","C语言程序设计","python程序设计","大数据导论",…...

静态资源导入探究

静态资源可以在哪里找呢&#xff1f;我们看看源码 从这个类进去 里面有个静态类 WebMvcAutoConfigurationAdapter 有个配置类&#xff0c;将这个类的对象创建并导入IOC容器里 这个静态类下有个方法 addResourceHandlers(ResourceHandlerRegistry registry)静态资源处理器 若自…...

安全狗V3.512048版本绕过

安全狗安装 安全狗详细安装、遇见无此服务器解决、在windows中命令提示符中进入查看指定文件夹手动启动Apache_安全狗只支持 glibc_2.14 但是服务器是2.17_黑色地带(崛起)的博客-CSDN博客 安全狗 safedogwzApacheV3.5.exe 右键电脑右下角安全狗图标-->选择插件-->安装…...

prometheus监控k8s kube-proxy target down

prometheus kube-proxy target down 解决 修改配置 kubectl edit cm/kube-proxy -n kube-systemmetricsBindAddress: "0.0.0.0:10249"删除 kube-proxy pod 使之重启应用配置 kubectl delete pod --force `kubectl get pod -n kube-system |grep kube-proxy|awk {pr…...

SPSS数据分析--假设检验的两种原假设取舍决定方式

假设检验的两种原假设取舍决定方式 在t检验&#xff0c;相关分析&#xff0c;回归分析&#xff0c;方差分析&#xff0c;卡方检验等等分析方法中&#xff0c;都需要用到假设检验。假设检验的步骤一般如下&#xff1a; 提出假设&#xff1a;H0 vs H1 ;假设原假设H0 成立的情况…...

Python实现猫狗分类

不废话了&#xff0c;直接上代码&#xff1a; def load_imagepath_from_csv(csv_name):image_path []with open(csv_name,r) as file:csv_reader csv.reader(file)next(csv_reader)for row in csv_reader:image_path.append(row[0])return image_pathimport csv csv_name &…...

pjsip、pjsua2+bcg729 windows下编译java版本

文章目录 简要说明流程步骤 简要说明 基本参考的这里 https://docs.pjsip.org/en/latest/get-started/windows/build_instructions.html#building-the-projects 我这里主要是为了生成pjsua2.dll 用于在java下调用。 其中 libbcg729.dll 是通过vcpkg来进行安装。 pjsip使用vs2…...

尝试多数据表 sqlite

C 唯一值得骄傲的地方就是 通过指针来回寻址 &#x1f602; 提高使用的灵活性 小脚本buff 加成...

Keil出现Flash Timeout.Reset the Target and try it again.我有一种解决方法

2.解决方法 网上查找了找原因&#xff0c;是因为之前代码设置了读保护功能。 读保护即大家通常说的“加密”&#xff0c;是作用于整个Flash存储区域。一旦设置了Flash的读保护&#xff0c;内置的Flash存储区只能通过程序的正常执行才能读出&#xff0c;而不能通过下述任何一种…...

纯粹即刻,畅享音乐搜索的轻松体验

纯粹即刻&#xff0c;畅享音乐搜索的轻松体验 在当今快节奏的生活中&#xff0c;我们常常渴望一种简单而便捷的方式来探索和享受音乐。现在&#xff0c;你可以纯粹即刻地畅享音乐搜索的轻松体验。无论你是寻找热门歌曲还是探索不同风格的音乐&#xff0c;这款应用将为你带来随…...

动态规划之树形DP

动态规划之树形DP 树形DP何为树形DP 树形DP例题HDU-1520 Anniversary partyHDU-2196 Computer834. 树中距离之和 树形DP 何为树形DP 树形DP是指在“树”这种数据结构上进行的动态规划&#xff1a;给出一颗树&#xff0c;要求以最少的代价&#xff08;或取得最大收益&#xff…...

嵌入式_GD32使用宏开关进行Debug串口打印调试

嵌入式_GD32使用宏开关进行Debug串口打印调试 串口Debug是一种将数据通过串口发送的方法。通过使用printf函数&#xff0c;我们可以将需要发送的数据格式化为字符串&#xff0c;并通过串口发送出去。在C语言中&#xff0c;通常使用串口发送数据的函数为printf函数&#xff0c;…...

使用 GitHub Copilot 进行 Prompt Engineering 的初学者指南(译)

文章目录 什么是 GitHub Copilot ?GitHub Copilot 可以自己编码吗&#xff1f;GitHub Copilot 的底层是如何工作的&#xff1f;什么是 prompt engineering?这是 prompt engineering 的另一个例子 使用 GitHub Copilot 进行 prompt engineering 的最佳实践提供高级上下文&…...

c++开发模式,享元模式

享元模式&#xff0c;个人理解&#xff0c;就是应用共享技术来减少类的对象创建&#xff0c;节省计算机资源消耗&#xff0c;而且能够减少维护成本 #include <iostream> #include <string> #include <vector>using namespace std;class Flyweight { public:…...

LLM大模型——langchain相关知识总结

目录 一、简介LangChain的主要价值支柱简单安装 二、 LangChain的主要模块1.Model I/Oprompt模版定义调用语言模型 2. 数据连接3. chains4. Agents5. MemoryCallbacks 三、其他记录多进程调用 主要参考以下开源文档 文档地址&#xff1a;https://python.langchain.com/en/lates…...

【Python】数据可视化利器PyCharts在测试工作中的应用

目录 PyCharts 简介 PyCharts 的安装 缺陷统计 测试用例执行情况 使用JavaScript情况 缺陷趋势分析 将两张图放在一个组合里&#xff08;grid&#xff09; 将两张图重叠成一张图&#xff08;overlap&#xff09; 将多张图组合在一个page 中&#xff08;page&#xff0…...

AOP的实战(统一功能处理模块)

一、用户登录权限效验 用户登录权限的发展从之前每个方法中自己验证用户登录权限&#xff0c;到现在统一的用户登录验证处理&#xff0c;它是一个逐渐完善和逐渐优化的过程。 1.1 最初用户登录验证 我们先来回顾一下最初用户登录验证的实现方法&#xff1a; RestController…...

时间复杂度为O(n2)的三种简单排序算法

1.冒泡排序 冒泡排序只会操作相邻的两个数据。每次冒泡操作都会对相邻的两个元素进行比较&#xff0c;看是否满足大小关系要求。如果不满足就让它俩互换。一次冒泡会让至少少一个元素移动到它应该在的位置&#xff0c;重复n次&#xff0c;就完成了n个数据的排序工作。 /*** …...

LeetCode 热题 100 JavaScript --226. 翻转二叉树

给你一棵二叉树的根节点 root &#xff0c;翻转这棵二叉树&#xff0c;并返回其根节点。 示例 3&#xff1a; 输入&#xff1a;root [] 输出&#xff1a;[] 提示&#xff1a; 树中节点数目范围在 [0, 100] 内 -100 < Node.val < 100 var invertTree function(root…...

hive所有窗口函数详情总结

hive窗口函数详情总结 解释语法hive开窗函数排序开窗函数样例数据RANK()DENSE_RANK()ROW_NUMBER() 分析开窗函数样例数据&#xff1a;last_valuefirst_valuelaglead 其他窗口函数cume_distpercent_rank 解释 开窗函数用于为行定义一个窗口&#xff08;指运算将要操作的行的集合…...

IDEA运行Tomcat出现乱码问题解决汇总

最近正值期末周&#xff0c;有很多同学在写期末Java web作业时&#xff0c;运行tomcat出现乱码问题&#xff0c;经过多次解决与研究&#xff0c;我做了如下整理&#xff1a; 原因&#xff1a; IDEA本身编码与tomcat的编码与Windows编码不同导致&#xff0c;Windows 系统控制台…...

生成xcframework

打包 XCFramework 的方法 XCFramework 是苹果推出的一种多平台二进制分发格式&#xff0c;可以包含多个架构和平台的代码。打包 XCFramework 通常用于分发库或框架。 使用 Xcode 命令行工具打包 通过 xcodebuild 命令可以打包 XCFramework。确保项目已经配置好需要支持的平台…...

conda相比python好处

Conda 作为 Python 的环境和包管理工具&#xff0c;相比原生 Python 生态&#xff08;如 pip 虚拟环境&#xff09;有许多独特优势&#xff0c;尤其在多项目管理、依赖处理和跨平台兼容性等方面表现更优。以下是 Conda 的核心好处&#xff1a; 一、一站式环境管理&#xff1a…...

让AI看见世界:MCP协议与服务器的工作原理

让AI看见世界&#xff1a;MCP协议与服务器的工作原理 MCP&#xff08;Model Context Protocol&#xff09;是一种创新的通信协议&#xff0c;旨在让大型语言模型能够安全、高效地与外部资源进行交互。在AI技术快速发展的今天&#xff0c;MCP正成为连接AI与现实世界的重要桥梁。…...

学习STC51单片机32(芯片为STC89C52RCRC)OLED显示屏2

每日一言 今天的每一份坚持&#xff0c;都是在为未来积攒底气。 案例&#xff1a;OLED显示一个A 这边观察到一个点&#xff0c;怎么雪花了就是都是乱七八糟的占满了屏幕。。 解释 &#xff1a; 如果代码里信号切换太快&#xff08;比如 SDA 刚变&#xff0c;SCL 立刻变&#…...

以光量子为例,详解量子获取方式

光量子技术获取量子比特可在室温下进行。该方式有望通过与名为硅光子学&#xff08;silicon photonics&#xff09;的光波导&#xff08;optical waveguide&#xff09;芯片制造技术和光纤等光通信技术相结合来实现量子计算机。量子力学中&#xff0c;光既是波又是粒子。光子本…...

MacOS下Homebrew国内镜像加速指南(2025最新国内镜像加速)

macos brew国内镜像加速方法 brew install 加速formula.jws.json下载慢加速 &#x1f37a; 最新版brew安装慢到怀疑人生&#xff1f;别怕&#xff0c;教你轻松起飞&#xff01; 最近Homebrew更新至最新版&#xff0c;每次执行 brew 命令时都会自动从官方地址 https://formulae.…...

【无标题】湖北理元理律师事务所:债务优化中的生活保障与法律平衡之道

文/法律实务观察组 在债务重组领域&#xff0c;专业机构的核心价值不仅在于减轻债务数字&#xff0c;更在于帮助债务人在履行义务的同时维持基本生活尊严。湖北理元理律师事务所的服务实践表明&#xff0c;合法债务优化需同步实现三重平衡&#xff1a; 法律刚性&#xff08;债…...

【UE5 C++】通过文件对话框获取选择文件的路径

目录 效果 步骤 源码 效果 步骤 1. 在“xxx.Build.cs”中添加需要使用的模块 &#xff0c;这里主要使用“DesktopPlatform”模块 2. 添加后闭UE编辑器&#xff0c;右键点击 .uproject 文件&#xff0c;选择 "Generate Visual Studio project files"&#xff0c;重…...

PH热榜 | 2025-06-08

1. Thiings 标语&#xff1a;一套超过1900个免费AI生成的3D图标集合 介绍&#xff1a;Thiings是一个不断扩展的免费AI生成3D图标库&#xff0c;目前已有超过1900个图标。你可以按照主题浏览&#xff0c;生成自己的图标&#xff0c;或者下载整个图标集。所有图标都可以在个人或…...