stacked-chart-visualization
处理包含百分比字符串的分类占比数据,通过补全缺失维度并生成堆叠柱状图,直观展示多维度构成随时间或分类的变化趋势。
npx skills add OpenSenseNova/SenseNova-Skills --skill stacked-chart-visualization --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Stacked_Chart_Visualization Step1 定义百分比转换函数并提取原始数据。通过正则表达式或字符串处理将百分比格式转换为可计算的浮点数。 ```python import pandas as pd import matplotlib.pyplot as plt import seaborn as sns # 配置中文字体,确保图表标签正常显示 plt.rcParams['font.sans-serif'] = ['SimHei', 'DejaVu Sans'] plt.rcParams['axes.unicode_minus'] = False def convert_percentage(val): """ 将百分比字符串转换为浮点数。 处理逻辑:去除百分号并转换为 float,若已经是数值则直接返回。 """ if isinstance(val, str): return float(val.strip('%')) return val # 示例数据提取逻辑(实际应用中替换为从 DataFrame 提取) time_labels = ['1月', '2月', '3月', '4月', '5月', '6月'] # 泛化时间轴 cat1_raw = ['23.21%', '22.98%', '24.31%', '24.53%', '23.84%', '24.80%'] cat2_raw = ['25.17%', '25.67%', '25.77%', '25.98%', '25.17%', '25.61%'] cat3_raw = ['28.12%', '28.37%', '26.58%', '25.83%', '26.49%', '25.17%'] cat1_ratios = [convert_percentage(x) for x in cat1_raw] cat2_ratios = [convert_percentage(x) for x in cat2_raw] cat3_ratios = [convert_percentage(x) for x in cat3_raw] ``` Step2 构建结构化数据表,将清洗后的数值整合进 DataFrame 以便进行向量化计算。 ```python # 构建包含时间维度和各分类占比的结构化数据表 df = pd.DataFrame({ 'group_col': time_labels, 'cat_1': cat1_ratios, 'cat_2': cat2_ratios, 'cat_3': cat3_ratios }) ``` Step3 计算缺失维度的占比。在已知部分维度占比的情况下,通过总和 100% 的约束推算剩余维度的数值,并进行数据校验。 ```python # 计算已
What does the stacked-chart-visualization skill do?
处理包含百分比字符串的分类占比数据,通过补全缺失维度并生成堆叠柱状图,直观展示多维度构成随时间或分类的变化趋势。
How do I install it?
Run `npx skills add OpenSenseNova/SenseNova-Skills --skill stacked-chart-visualization --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From OpenSenseNova/SenseNova-Skills, a repository with 4,911 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
