histogram

Python - Count occurrences of certain ranges in a list

送分小仙女□ 提交于 2019-12-30 03:31:08
问题 So basically I want to count the number of occurrences a floating point appears in a given list. For example: a list of grades (all scores out of 100) are inputted by the user and they are sorted in groups of ten. How many times do scores from 0-10, 10-20, 20-30.. etc) appear? Like test score distribution. I know I can use the count function but since I'm not looking for specific numbers I'm having trouble. Is there a away to combine the count and range? Thanks for any help. 回答1: To group the

Centering histogram bins and setting percentage range in Matlab

孤者浪人 提交于 2019-12-29 09:19:42
问题 I'm doing data-analysis in Matlab and I'm plotting the frequencies of discrete values (1-15) into a histogram on Matlab. I would like to center the bins so that the center of 1st bin is on value 1, center of the 2nd bin is on value 2, etc. Also I would like to get percentage range for the Y-axis. Any quick ideas how to do this? Here is a picture highlighting my question: 回答1: Start by using hist with your expected centers. Then use bar and xlabel to display the histogram with the y axis the

How to center labels in histogram plot

烂漫一生 提交于 2019-12-29 06:43:10
问题 I have a numpy array results that looks like [ 0. 2. 0. 0. 0. 0. 3. 0. 0. 0. 0. 0. 0. 0. 0. 2. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 1. 1. 0. 0. 0. 0. 2. 0. 3. 1. 0. 0. 2. 2. 0. 0. 0. 0. 0. 0. 0. 0. 1. 1. 0. 0. 0. 0. 0. 0. 2. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 3. 1. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 1. 2. 2.] I would like to plot a histogram of it. I have tried import matplotlib.pyplot as plt plt.hist(results, bins=range(5)) plt.show() This gives me a

matlab: efficient computation of local histograms within circular neighboorhoods

旧城冷巷雨未停 提交于 2019-12-29 06:24:13
问题 I've an image over which I would like to compute a local histogram within a circular neighborhood. The size of the neighborhood is given by a radius . Although the code below does the job, it's computationally expensive. I run the profiler and the way I'm accessing to the pixels within the circular neighborhoods is already expensive. Is there any sort of improvement/optimization based maybe on vectorization? Or for instance, storing the neighborhoods as columns? I found a similar question in

How to plot a density map in python?

假装没事ソ 提交于 2019-12-29 03:53:13
问题 I have a .txt file containing the x,y values of regularly spaced points in a 2D map, the 3rd coordinate being the density at that point. 4.882812500000000E-004 4.882812500000000E-004 0.9072267 1.464843750000000E-003 4.882812500000000E-004 1.405174 2.441406250000000E-003 4.882812500000000E-004 24.32851 3.417968750000000E-003 4.882812500000000E-004 101.4136 4.394531250000000E-003 4.882812500000000E-004 199.1388 5.371093750000000E-003 4.882812500000000E-004 1278.898 6.347656250000000E-003 4

plot histogram of datetime.time python / matplotlib

…衆ロ難τιáo~ 提交于 2019-12-28 13:26:24
问题 I am trying to plot a histogram of datetime.time values. Where these values are discretized into five minute slices. The data looks like this, in a list: ['17:15:00', '18:20:00', '17:15:00', '13:10:00', '17:45:00', '18:20:00'] I would like to plot a histogram, or some form of distribution graph so that the number of occurrences of each time can be examined easily. NB. Given each time is discretised then. The maximum number of bins in a histogram would be 288 = (60 / 5 * 24) I have looked at

plot histogram of datetime.time python / matplotlib

穿精又带淫゛_ 提交于 2019-12-28 13:25:52
问题 I am trying to plot a histogram of datetime.time values. Where these values are discretized into five minute slices. The data looks like this, in a list: ['17:15:00', '18:20:00', '17:15:00', '13:10:00', '17:45:00', '18:20:00'] I would like to plot a histogram, or some form of distribution graph so that the number of occurrences of each time can be examined easily. NB. Given each time is discretised then. The maximum number of bins in a histogram would be 288 = (60 / 5 * 24) I have looked at

Plot two histograms at the same time with matplotlib

荒凉一梦 提交于 2019-12-27 10:25:01
问题 I created a histogram plot using data from a file and no problem. Now I wanted to superpose data from another file in the same histogram, so I do something like n,bins,patchs = ax.hist(mydata1,100) n,bins,patchs = ax.hist(mydata2,100) but the problem is that for each interval, only the bar with the highest value appears, and the other is hidden. I wonder how could I plot both histograms at the same time with different colors. 回答1: Here you have a working example: import random import numpy

Plot two histograms at the same time with matplotlib

孤街醉人 提交于 2019-12-27 10:24:50
问题 I created a histogram plot using data from a file and no problem. Now I wanted to superpose data from another file in the same histogram, so I do something like n,bins,patchs = ax.hist(mydata1,100) n,bins,patchs = ax.hist(mydata2,100) but the problem is that for each interval, only the bar with the highest value appears, and the other is hidden. I wonder how could I plot both histograms at the same time with different colors. 回答1: Here you have a working example: import random import numpy

opencv drawing a 2d histogram

一世执手 提交于 2019-12-27 10:19:30
问题 I'm wondering how to plot a 2d histogram of an HSV Mat in opencv c++. My current code attempting to display it fails miserably. I've looked around on how to plot histograms and all the ones I've found were those plotting them as independent 1d histograms. Here's my current output with the number of hue bins being 30 and saturation bins being 32: Here's another output with the number of hue bins being 7 and saturaation bins being 5: I would like it to look more like the result here http://docs