我修改了此处的 scatter_hist.py示例,以便绘制两个数据集.
我想要有"stepfilled"类型的直方图,但不知何故,如果我设置"stepfilled"类型,Y轴直方图(orientation ="horizontal")不起作用.
有没有其他方法可以使直方图看起来像"stepfilled"式或者我做错了什么?
这是我的代码与histtype ="bar",以显示我尝试做的想法.将其更改为
histtype="stepfilled"
Run Code Online (Sandbox Code Playgroud)
得到奇怪的直方图:
import numpy as np
import matplotlib.pyplot as plt
# the random data
x = np.random.randn(1000)
y = np.random.randn(1000)
x_vals = [x]
y_vals = [y]
x_vals.append( np.random.randn( 300 ) )
y_vals.append( np.random.randn( 300 ) )
fig = plt.figure(1, figsize=(5.5,5.5))
from mpl_toolkits.axes_grid1 import make_axes_locatable
colour_LUT = ['#0000FF',
'#00FF00']
# the scatter plot:
xymax = np.max(np.fabs(x))
colors = []
axScatter = plt.subplot(111)
for i in range( len(x_vals ) ):
colour = colour_LUT[i]
xymax …Run Code Online (Sandbox Code Playgroud)