[英]Histogram with base 2 logarithmic y-scale in matplotlib?
有沒有辦法做到這一點? 當我嘗試指定base
或basey
時, hist
命令似乎無法識別它。
注意:下面的解決方案適用於matplotlib版本<1.3.1。
使用
ax.set_yscale('log', basey=2)
import numpy as np
import matplotlib.pyplot as plt
mu, sigma = 100, 15
fig, ax = plt.subplots()
x = mu + sigma * np.random.randn(10000)
ax.set_yscale('log', basey=2)
n, bins, histpatches = ax.hist(x, 50, facecolor='green', alpha=0.75)
plt.show()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.