커뮤니티
Python
제목:    plot 한글, 마이너스깨짐 대처
  1306   김윤중
  • 전역 파라메터 세팅
    • #한글 - 깨짐 방지를 위한 font와 unicode_minus 처리 전역으로 처리
      import matplotlib as mpl
      import matplotlib.font_manager as fm
      nanum=[(f.name, f.fname) for f in fm.fontManager.ttflist if 'Nanum' in f.name]
      #[('NanumGothic', 'C:\\Windows\\Fonts\\NanumGothicBold.ttf'), ('NanumGothic', 'C:\\Windows\\Fonts\\NanumGothic.ttf')]
      plt.rcParams["font.family"] = nanum[0][0]
      mpl.rcParams['axes.unicode_minus'] = False #-깨짐방지
    •  
  • matplotlibrc 파일의  파라메터 수정 (적색)
    • C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\Lib\site-packages\matplotlib\mpl-data\matplotlibrc
    • 197 .family         : NanumGothic
    • 198 t.style          : normal
    • 199#font.variant        : normal
    •  
    • 323 s.spines.top    : True
    • 327 .spines.right  : True
    • 328 .unicode_minus  : False   
    •