Seaborn 图未显示 [英] Seaborn Plot is not displaying

查看:108
本文介绍了Seaborn 图未显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试使用 Seaborn 绘制一个简单的条形图.奇怪的是,以前的情节有效,但这些情节没有出现.没有错误被抛出,据我所知代码没问题.也许更有经验的眼睛会发现错误.

I have been trying to plot a simple bar chart using Seaborn. Oddly enough the previous plots worked, but these ones do not appear. No error is being thrown and as far as I can tell the code is okay. Perhaps a more experienced eye will be able to find an error.

import pandas as pd
import numpy as np
import pyodbc 
import matplotlib.pyplot as plt
import seaborn as sns

region_pct_25 = region_totals.iloc[0:6, :]
region_pct_25['Opp_Lives_pct'] = ((region_pct_25.Lives / region_pct_25.Lives.sum())*100).round(2)
region_pct_25.reset_index(level=['RegionName'], inplace=True)
region_25_plt = sns.barplot(x="RegionName", y="Opp_Lives_pct", data=region_pct_25, color = 'g').set_title("Client Usage by Region: ADD ")
plt.show()

没有显示任何情节.请尽你所能提供帮助!

No plot is showing. Please help wherever you can!

推荐答案

在序言中添加 %matplotlib inline 解决了问题!

adding %matplotlib inline to the preamble resolved the issue!

这篇关于Seaborn 图未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆