
19
1.4 正規化
with plt.style.context('style/thinner.mplstyle'):
ax.boxplot(np.log(counts_subset_lib_norm + 1))
ax.set_xlabel("Individuals")
ax.set_ylabel("log gene expression counts")
reduce_xaxis_labels(ax, 5)
■
かなりよくなりましたね。上記のコードでブロードキャスティングを
2
度も使ったことにも注
目してください。
1
回目は、すべての遺伝子発現リード数をその列の総リード数で割るとき、
2
回
目は値に
100
万を掛けるときです。
最後に、正規化したデータと生のデータを比べてみましょう。
import itertools as it
from collections import defaultdict
def class_boxplot(data, classes, colors=None, **kwargs):
"""Make a boxplot with boxes colored according to the class they belong to.
所属クラスごとに色分けした箱ひげ図を描く。
Parameters
パラメータ
----------
data : list of array-like of float
浮動小数点数の
array-like
のリスト
The input data. ...