histogram

Count strings occurrences and plot histogram

别来无恙 提交于 2019-12-01 16:37:34
问题 Is there any straightforward way to create a histogram from a cell array like the one below? The spacing between the consecutive bars should be exactly the same and the labels of the x-axis should be the corresponding names of the variables below in a vertical orientation. 'w464' 'w462' 'w461' 'w464' 'w461' 'w463' 'w466' 'w461' 回答1: I would like to know a better way, as well. Fwiw, I have used countmember in a roundabout way to plot data like this. I.E. if the data you posted was named A >> B

weights option for seaborn distplot?

爷,独闯天下 提交于 2019-12-01 16:30:19
I'd like to have a weights option in seaborn distplot, similar to that in numpy histogram. Without this option, the only alternative would be to apply the weighting to the input array, which could result in an impractical size (and time). vlasisva You can provide weights by passing them to the underlying matplotlib's histogram function using the hist_kws argument, as: sns.distplot(..., hist_kws={'weights': your weights array}, ...) Take note though, that the weights will be passed only to the underlying histogram; neither the kde, nor the fit functions of the distplot will be affected. 来源:

Histogram with logarithmic bins and normalized

混江龙づ霸主 提交于 2019-12-01 14:33:25
I want to make a histogram of every column of a matrix, but I want the bins to be logarithmic and also normalized. And after I create the histogram I want to make a fit on it without showing the bars. This is what I have tried: y=histogram(x,'Normalized','probability'); This gives me the histogram normalized, but I don't know how to make the bins logarithmic. There are two different ways of creating a logarithmic histogram: Compute the histogram of the logarithm of the data. This is probably the nicest approach, as you let the software decide on how many bins to create, etc. The x-axis now

weights option for seaborn distplot?

孤者浪人 提交于 2019-12-01 14:13:27
问题 I'd like to have a weights option in seaborn distplot, similar to that in numpy histogram. Without this option, the only alternative would be to apply the weighting to the input array, which could result in an impractical size (and time). 回答1: You can provide weights by passing them to the underlying matplotlib's histogram function using the hist_kws argument, as: sns.distplot(..., hist_kws={'weights': your weights array}, ...) Take note though, that the weights will be passed only to the

Getting dominant colour value from HSV Histogram

隐身守侯 提交于 2019-12-01 14:04:40
I am creating a hsv histogram from an image like below. - (void)processImageWithHsv:(Mat&)image; { Mat image_hsv; cvtColor(image, image_hsv, CV_BGR2HSV); int hbins = 50, sbins = 60; int histSize[] = {hbins, sbins}; float hranges[] = { 0, 360 }; float sranges[] = { 0, 256 }; const float* ranges[] = { hranges, sranges }; MatND hist; int channels[] = {0, 1}; calcHist( &image_hsv, 1, channels, Mat(), // do not use mask hist, 2, histSize, ranges, true, // the histogram is uniform false ); double maxVal = 0; minMaxLoc(hist, 0, &maxVal, 0, 0); // ???: HOW Convert this information to colour value }

Matlab: generate random numbers from custom made probability density function

孤人 提交于 2019-12-01 13:46:17
I have a dataset with 3-hourly precipitation amounts for the month of January in the period 1977-1983 (see attachment). However, I want to generate precipitation data for the period 1984-1990 based upon these data. Therefore, I was wondering if it would be possible to create a custom made probability density function of the precipitation amounts (1977-1983) and from this, generate random numbers (precipitation data) for the desired period (1984-1990). Is this possible in Matlab and could someone help me by doing so? Thanks in advance! A histogram will give you an estimate of the PDF -- just

Plotting binned data using sum instead of count

亡梦爱人 提交于 2019-12-01 13:11:57
I've tried to search for an answer, but can't seem to find the right one that does the job for me. I have a dataset ( data ) with two variables: people's ages ( age ) and number of awards ( awards ) My objective is to plot the number of awards against age in R. FYI, a person can have multiple awards and people can have the same age. I tried to plot a histogram and barplot, but the problem with that is that it counts the number of observations instead of summing the number of awards. A sample dataset: age <- c(21,22,22,25,30,34,45,26,37,46,49,21) awards <- c(0,3,2,1,0,0,1,3,1,1,1,1) data <-

Histogram with logarithmic bins and normalized

荒凉一梦 提交于 2019-12-01 12:58:13
问题 I want to make a histogram of every column of a matrix, but I want the bins to be logarithmic and also normalized. And after I create the histogram I want to make a fit on it without showing the bars. This is what I have tried: y=histogram(x,'Normalized','probability'); This gives me the histogram normalized, but I don't know how to make the bins logarithmic. 回答1: There are two different ways of creating a logarithmic histogram: Compute the histogram of the logarithm of the data. This is

Getting dominant colour value from HSV Histogram

断了今生、忘了曾经 提交于 2019-12-01 12:04:53
问题 I am creating a hsv histogram from an image like below. - (void)processImageWithHsv:(Mat&)image; { Mat image_hsv; cvtColor(image, image_hsv, CV_BGR2HSV); int hbins = 50, sbins = 60; int histSize[] = {hbins, sbins}; float hranges[] = { 0, 360 }; float sranges[] = { 0, 256 }; const float* ranges[] = { hranges, sranges }; MatND hist; int channels[] = {0, 1}; calcHist( &image_hsv, 1, channels, Mat(), // do not use mask hist, 2, histSize, ranges, true, // the histogram is uniform false ); double

Put histogram side-by-side

拜拜、爱过 提交于 2019-12-01 11:55:26
I want to group an histogram rowstacked in gnuplot similar to this image: I have these 2 files where the data from the histogram comes from: #Round-robin Input West-Virginia ChicagoI ChicagoII California 1500 28 25 28 19 3000 30 24 25 21 4500 28 28 25 19 6000 34 25 23 18 #Min-makespan Input West-Virginia ChicagoI ChicagoII California 1500 34 20 30 17 3000 33 30 21 16 4500 31 23 38 9 6000 42 21 38 0 plot for [i=2:5] 'cloudusage-roundrobin.dat' using i:xtic(1), \ for [i=2:5] 'cloudusage-minmakespan.dat' using i:xtic(1) 1 - My plot instruction stack both histograms, instead of having them side-by