Wednesday 9 September 2015

Visualize Data Density on 1 Dimension Axis


This source code clip is for visulizing data density on 1 axis like the following:



# reference:
# http://stackoverflow.com/questions/7352220/how-to-plot-1-d-data-at-given-y-value-with-pylab

import numpy as np
import matplotlib.pyplot as pp
import random

val = 0. # this is the value where you want the data to appear on the y-axis.
ar = np.random.random(size=40)
pp.plot(ar, np.zeros_like(ar) + val, '+')
pp.show()

No comments:

Post a Comment