bug
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- numpy, pandas, python
调研方向
该 issue 指向 Graph Gallery 的“Show Number of Observations” Python 示例;首先检查 boxplot 的设置以及后续对 ax.get_xticklabels() 的使用。确认该示例可以运行并渲染观测数量标签,然后检查其他 Python 示例是否存在同样的已报告错误。
由索引模型根据 Issue 内容生成。
描述
Hi Yan,
in the Graph Gallery in some example in Python there are mistakes
for example in the "Show Number of Observations"
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import pandas as pd
Dataset:
a = pd.DataFrame({ 'group' : np.repeat('A',500), 'value': np.random.normal(10, 5, 500) })
b = pd.DataFrame({ 'group' : np.repeat('B',500), 'value': np.random.normal(13, 1.2, 500) })
c = pd.DataFrame({ 'group' : np.repeat('B',500), 'value': np.random.normal(18, 1.2, 500) })
d = pd.DataFrame({ 'group' : np.repeat('C',20), 'value': np.random.normal(25, 4, 20) })
e = pd.DataFrame({ 'group' : np.repeat('D',100), 'value': np.random.uniform(12, size=100) })
df = pd.concat([a,b,c,d,e])
Start with a basic boxplot
sns.boxplot(x="group", y="value", data=df) # the assignment ax is missing
Calculate number of obs per group & median to position labels
medians = df.groupby(['group'])['value'].median().values
nobs = df.groupby("group").size().values
nobs = [str(x) for x in nobs.tolist()]
nobs = ["n: " + i for i in nobs]
Add it to the plot
pos = range(len(nobs))
for tick,label in zip(pos,ax.get_xticklabels()):
plt.text(pos[tick], medians[tick] + 0.4, nobs[tick], horizontalalignment='center', size='medium', color='w', weight='semibold')
add title
plt.title("Boxplot with number of observation", loc="left")
show the graph
plt.show()
================
Best regards
--Marco
- 主要语言
- HTML
- 星标
- 2.3k
- 派生
- 439
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
holtzy/The-Python-Graph-Gallery 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
holtzy/The-Python-Graph-Gallery#542 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 78/100
-
tutorial to add未关闭
难度 3/5 1-2 天 新手友好度 25/100
-
难度 2/5 1-3 小时 新手友好度 38/100
-
难度 3/5 1-2 天 新手友好度 30/100
查看 holtzy/The-Python-Graph-Gallery 的全部 Issue
相似的 Issue
-
essreduce
难度 2/5 1-3 小时 新手友好度 69/100
维护者通常 1 天内回复
-
effort:S P3
难度 2/5 1-3 小时 新手友好度 79/100
nightscout/nocturne#4902 · 2 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 79/100
openlayers/openlayers#17777 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
OHDSI/Data2Evidence#3796 · 1 条评论 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100