python - Adding total values to seaborn plot python
问题描述
I have a Seaborn plot in Python to map the total values for a response to a survey. I am happy to post more of the code if needed but the plot is just using 2 columns from a Pandas Dataframe - country and total - and plotting these.
# Initialize the matplotlib figure
f, ax = plt.subplots(figsize=(10, 6))
# Plot the total by country
sns.set_color_codes("colorblind")
sns.barplot(x="Total", y=top_10_countries.index, data = top_10_countries, label="Total")
# Add a legend and informative axis label
ax.legend(ncol=2, loc="lower right", frameon=True)
ax.set(ylabel="", xlabel="Respondents by country")
What I want to do is add on the end of each of the countries what the actual total is, i.e. on the end of the bar for the USA, I want to add 820, add 180 on UK, and so on.
Is this possible?
解决方案
推荐阅读
- c - 指针是否支持“数组样式索引”?
- c++ - 使用模板化操作符<< 输出集合的集合
- angular - Angular - 专注于点击时具有动态 ID 的输入
- java - oracle weblogic OAM servlet 代理 - 如何传播 OAMAuthnCookie
- c - Char 数组到 Int 的转换
- javascript - 控制器返回空值
- docker - Windows 上的 Dockerfile 复制超时问题
- python - 如何从 pvLIB 中的 GHI 数据计算 DNI 和 DHI?
- django - 如何在 django 的模型中定义日期格式?
- android - 从纬度和经度坐标创建 GregorianCalendar?