2017-03-25 1 views
5

jupyter notebook에서 matshow()의 무화과 크기를 변경하는 방법은 무엇입니까? Matplotlib matshow의 figsize 변경 방법

예를 들어,이 코드 변경 그림 크기

%matplotlib inline 
import matplotlib.pyplot as plt 
import pandas as pd 

d = pd.DataFrame({'one' : [1, 2, 3, 4, 5], 
        'two' : [4, 3, 2, 1, 5]}) 
plt.figure(figsize=(10,5)) 
plt.plot(d.one, d.two) 

그러나 아래 코드는 plt.figure()이 수치와 함께 할 수 있도록

기본적으로
%matplotlib inline 
import matplotlib.pyplot as plt 
import pandas as pd 

d = pd.DataFrame({'one' : [1, 2, 3, 4, 5], 
        'two' : [4, 3, 2, 1, 5]}) 
plt.figure(figsize=(10,5)) 
plt.matshow(d.corr()) 

답변

10

plt.matshow()은, 자신의 그림을 만들어 작동하지 않습니다 그리고 matshow 줄거리를 호스트하는 것은 figsize set을 가진 것이 아닙니다.

  1. matplotlib.axes.Axes.matshow 대신 pyplot.matshow의를 사용하여 fignum 인수

    plt.figure(figsize=(10,5)) 
    plt.matshow(d.corr(), fignum=1) 
    
  2. 플롯 matshow을 사용

    두 가지 옵션이 있습니다.

    fig, ax = plt.subplots(figsize=(10,5)) 
    ax.matshow(d.corr()) 
    
관련 문제