2014年7月30日水曜日

pandasのデフォルトカラーマップを取得

import pandas as pd
pd.set_option('display.mpl_style', 'default')  
ここに使われているカラーマップどこにあるか分からなかったので色を取得した。
 
fig,ax=subplots(1,1)
pd.DataFrame(randn(7,7)).plot(ax=ax)
lines = ax.get_lines()
labels = [line.get_color() for line in lines]
legend(labels)
print labels 


['#348ABD', '#7A68A6', '#A60628', '#467821', '#CF4457', '#188487', '#E24A33']


2014年7月23日水曜日

awesomeでxrandrを使ってもうまくいかない問題の暫定的対処法


  • unityやunity-2Dでログイン後、設定からディスプレイの設定を行う。
  • awesomeでログインし直すと、その通りの設定になっている。

2014年7月17日木曜日

pythonの棒グラフで一部の色を変える

import pandas as pd
import numpy as np
import matplotlib.pylab as plt
num = 10 #棒の数
base = 'c' #基本の色
newcolor = 'm' #変える色
ser = pd.Series(np.random.randn(num))
colors = [base]*num #基本色
colors[ser.idxmax()] = newcolor #最大値の色を変える
ser.plot(kind='bar',color=colors)
plt.savefig('./output.png')


2014年7月16日水曜日

TeXで表のセルに網掛け

\usepackage{color,colortbl}
tabular環境中の任意のセルで、例えば、

\cellcolor[gray]{0.85}

2014年7月15日火曜日

TeXでヘッダ、フッタ

 fancyhdrを使う。
\usepackage{fancyhdr}
\pagestyle{fancy}
\chead{title}
\rhead{\today \ \ authorname}

2014年7月14日月曜日

TeXで図表をなるべく1ページに収める

図・表 http://aquarius10.cse.kyutech.ac.jp/~otabe/koho/node25.html

\setcounter{topnumber}{2}       % ページの上の方に置ける図の数
\def\topfraction{.7}            % ページの上の方で図が占めることのできる割合
\setcounter{bottomnumber}{1}    % ページの下の方に置ける図の数
\def\bottomfraction{.3}         % ページの下の方で図が占めることのできる割合
\setcounter{totalnumber}{3}     % ページ内に置ける図の数
\def\textfraction{.2}           % ページ内の文章領域の最小の割合
\def\floatpagefraction{.5}      % 図表のページで図表の占める最小の割合
\setcounter{dbltopnumber}{2}    % 二段組時にページの上の方に置ける図の数
\def\dbltopfraction{.7}         % 二段組時にページの上の方で図が占める
                                % ことのできる割合
\def\dblfloatpagefraction{.5}   % 二段組時に図表のページで図表の占める
                                % 最小の割合

threeparttableの使い方


  •  table -> center -> threeparttable -> tabular -> tablenotes の順。
  •  tabularの中に\tnote{}を入れると後で注が使える。

\begin{table}
\begin{center}
\begin{threeparttable}
\caption{}
\label{}
\begin{tabular}{}
\hline
hogehoge\tnote{aaa}
\end{tabular}
\begin{tablenotes}
\item[aaa] bbb
\end{tablenotes}
\end{threeparttable}
\end{center}
\end{table}