1# -*- coding: utf-8 -*-
2"""
3In this example we draw two different kinds of histogram.
4"""
5import initExample ## Add path to library (just for examples; you do not need this)
6
7import pyqtgraph as pg
8from pyqtgraph.Qt import QtCore, QtGui
9import numpy as np
10
11win = pg.GraphicsLayoutWidget(show=True)
12win.resize(800,350)
13win.setWindowTitle('pyqtgraph example: Histogram')
14plt1 = win.addPlot()
15plt2 = win.addPlot()
16
17## make interesting distribution of values
18vals = np.hstack([np.random.normal(size=500), np.random.normal(size=260, loc=4)])
19
20## compute standard histogram
21y,x = np.histogram(vals, bins=np.linspace(-3, 8, 40))
22
23## Using stepMode="center" causes the plot to draw two lines for each sample.
24## notice that len(x) == len(y)+1
25plt1.plot(x, y, stepMode="center", fillLevel=0, fillOutline=True, brush=(0,0,255,150))
26
27## Now draw all points as a nicely-spaced scatter plot
28y = pg.pseudoScatter(vals, spacing=0.15)
29#plt2.plot(vals, y, pen=None, symbol='o', symbolSize=5)
30plt2.plot(vals, y, pen=None, symbol='o', symbolSize=5, symbolPen=(255,255,255,200), symbolBrush=(0,0,255,150))
31
32if __name__ == '__main__':
33    pg.exec()
34