Created
September 28, 2013 08:57
-
-
Save mkacky/6740092 to your computer and use it in GitHub Desktop.
test of legend position
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
# -*- coding: utf-8 -*- | |
import numpy as np | |
import matplotlib.pyplot as plt | |
x = np.arange(-2*np.pi, 2*np.pi, 0.1) | |
plt.plot(x, np.sin(x), label='sin(x)') | |
plt.plot(x, np.cos(x), label='cos(x)') | |
plt.grid(True) | |
# 1.2.1系では有効 | |
#lgnd = plt.legend(loc="upper center", bbox_to_anchor=(0.5,-0.05), ncol=2) | |
#plt.savefig("legend_pos.eps", bbox_extra_artists=(lgnd,), bbox_inches='tight') | |
# 0.99系での応急処置 | |
plt.legend(loc="upper center", | |
bbox_to_anchor=(0.5,-0.05), # 描画領域の少し下にBboxを設定 | |
ncol=2 # 2列 | |
) | |
plt.gcf().subplots_adjust(bottom=0.13) | |
plt.savefig("legend_pos.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment