|
From: Paul I. <piv...@gm...> - 2010-12-28 02:39:51
|
Philippe Piot, on 2010-12-27 13:58, wrote: > 1/ When executing the above script, I also display the histograms > generated when invoking "hist" (I tried to make this line tranparaent > by using alpha=0 but it did not work). Hi Philippe, welcome to matplotlib - I think what you really want to do is just use numpy's histogram function, and then plot the result. This is actually the function matplotlib's hist uses behind the scenes. > 2/ can I directly manipulate the data within an histogram to > arbitrarily offset the histogram? Once you get the histogram using numpy, you can plot it in in any way you want. Here's a small example: import numpy as np import matplotlib.pyplot as plt h,edges = np.histogram(np.random.randn(1000)) plt.bar(edges[:-1],h, width=edges[1]-edges[0]) plt.bar(edges[:-1]-10,h, width=edges[1]-edges[0]) #offset plt.step(edges[1:],h) # plot as step lines instead of bars plt.step(edges[1:]+10,h) # same as above, with an offset best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 |