2017-09-29 178 views
0

我有matplotlib 2.0.2seaborn 0.8,但兩者在jupyter notebook 5.0.0中似乎都不兼容。在我有一個老版本的matplotlib之前曾與seaborn一起工作,那麼有人知道matplotlib 2及以上版本是否有兼容的seaborn版本?它不會拋出任何錯誤,但它不能使用seaborn api應用設置,例如,下面的內容無法更改圖表的大小並應用指定的網格線。這並不在筆記本拋出錯誤,但不會應用這些設置:在jupyter筆記本上兼容matplotlib 2及以上版本的seaborn版本5.0.0

import matplotlib.pyplot as plt 

%matplotlib inline 

import seaborn as sns 
sns.set_style("whitegrid") 
sns.set_context(rc={"figure.figsize": (17, 8)}) 

我不知道這是否是在我申請進口的順序?

見下面我Python和jupyter筆記本版本

enter image description here

+0

matplotlib 2.0.2與seaborn 0.8完美兼容!你遇到什麼問題? – ImportanceOfBeingErnest

+0

謝謝,讓我給問題添加更多的細節...我在jupyter筆記本5.0.0 – tsando

+0

中遇到這個問題好吧,我已經添加了細節 - 請參閱上面,讓我知道如果你有任何想法! thx – tsando

回答

1

sns.set_style("whitegrid")正確應用的屏幕截圖。關於sns.set_context,我懷疑它可以用來改變圖的大小;它意味着設置上下文並且可能適應像線條樣式之類的東西。但是這隻適用於任何版本的seaborn。我想你想用sns.set

%matplotlib inline 
import matplotlib.pyplot as plt 
import seaborn as sns 
sns.set(style="whitegrid",rc={"figure.figsize": (17, 8)}) 

enter image description here

+0

謝謝,我確認'sns.set(style =「whitegrid」,rc = {「figure.figsize」:(17,8)})'工作,但'sns.set_context(rc = {「figure.figsize」 :(17,8)})'以前用過,因爲我總是在我所有的筆記本中使用它來更改大小,然後更新到最新的jupyter筆記本和matplotlib – tsando

+0

也許它是偶然發生的,但由於它並非實際意味着能夠改變圖形大小,一旦沒有工作,就無人照顧。可以肯定的是,在哪些版本的matplotlib,seaborn和jupyter中它確實能夠正常工作? – ImportanceOfBeingErnest