![]() Plt.step(np.concatenate(, sorted_data]]), This can be achieved with: plt.step(np.concatenate(]]), PS: As SebastianRaschka noted, the very last point should ideally show the total count (instead of the total count-1). You can see that it is more ragged than the output of EnricoGiampieri's answer, but this one is the real histogram (instead of being an approximate, fuzzier version of it). Plt.step(sorted_data, np.arange(sorted_data.size)) # From the number of data points-1 to 0įurthermore, a more appropriate plot style is indeed plt.step() instead of plt.plot(), since the data is in discrete locations. ![]() Plt.step(sorted_data, np.arange(sorted_data.size)) # From 0 to the number of data points-1 ![]() ![]() Sorted_data = np.sort(data) # Or data.sort(), if data can be modified This shorter and simpler solution looks like this: import numpy as np Using histograms is really unnecessarily heavy and imprecise (the binning makes the data fuzzy): you can just sort all the x values: the index of each value is the number of values that are smaller. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |