histogram

Create histogram (not barplot) from categorical variable

半城伤御伤魂 提交于 2019-12-13 00:07:11
问题 I know you usually should use a barplot for categorical variables but in my case somebody split the continuous variable into groups and it would be nice to have a histogram anyway. This is what I want to get (except as a histogram): par(oma=c(2,0,0,0)) #so labels are not cut off barplot(table(hhincome),ylab = "Frequency", main = "Netto houshold income", border="black", col="grey",las=2) (Note: A histogram has no space between bars and a x-axis) Data: hhincome <- structure(c(4L, 4L, 1L, 6L, 8L

The dimensions in hist for numpy.histogram with density = True

时光总嘲笑我的痴心妄想 提交于 2019-12-12 19:19:38
问题 let's say I have this array A: array([ 0.0019879 , -0.00172861, -0.00527226, 0.00639585, -0.00242005, -0.00717373, 0.00371651, 0.00164218, 0.00034572, -0.00864304, -0.00639585, 0.006828 , 0.00354365, 0.00043215, -0.00440795, 0.00544512, 0.00319793, 0.00164218, 0.00025929, -0.00155575, 0.00129646, 0.00259291, -0.0039758 , 0.00328436, 0.00207433, 0.0011236 , 0.00440795, 0.00164218, -0.00319793, 0.00233362, 0.00025929, 0.00017286, 0.0008643 , 0.00363008]) If I run: np.histogram(A, bins=9,

Modify bin labels histogram

╄→гoц情女王★ 提交于 2019-12-12 19:18:22
问题 I made the following histogram: one <- c(2,2,3,3,3,3,4,4,4,4,4,4,5,5,5,5,6,6,7,8) hist(one, breaks = 3) Instead of a range from 2-8 on the x-axis, I need three labels on the x-axis that summarize the range of values like this: 2-3; 4-5; 6-8 How can I modify the code for the x-axis to get just three labels, and in the correct location? 回答1: It's easy to label midpoints for the ranges using: h <- hist(one, breaks = 3, xaxt = 'n') axis(1, h$mids, h$mids) But if you want to have the labels be

Gnuplot histogram 3d

你。 提交于 2019-12-12 19:14:10
问题 I'm looking for a way to plot histograms in 3d to produce something like this figure http://www.gnuplot.info/demo/surface1.17.png but where each series is a histogram. I'm using the procedure given here https://stackoverflow.com/a/19596160 and http://www.gnuplotting.org/calculating-histograms/ to produce histograms, and it works perfectly in 2d. Basically, the commands I use are hist = 'u (binwidth*(floor(($2-binstart)/binwidth)+0.5)+binstart):(1) smooth freq w boxes plot 'data.txt' @hist Now

Draw frequency density histogram in R

怎甘沉沦 提交于 2019-12-12 17:25:53
问题 Using R, can anyone show me how to draw a simple histogram with no gaps between the bins of the following data :- Class Width Freq. Dist 0 <= x < 5 0.2 5 <= x < 15 0.1 15 <= x < 20 1.2 20 <= x < 30 0.4 30 <= x < 40 0.4 So I want the X axis to go from 0-5,5-15,15-20,20-30 and 30-40 with the bars drawn appropriately. Thanks in advance ! 回答1: How about this one? breaks <- c(0,5,15,20,30,40) counts <- c(0.2, 0.1, 1.2, 0.4, 0.4) barplot(counts, names=sprintf("[%g,%g)", breaks[-length(breaks)],

Make a histogram clearer by assigning names to different segments of each bar in R

若如初见. 提交于 2019-12-12 14:27:42
问题 Assume that I have a data frame with two columns and 19 rows (see below); The left column is the name of cell lines and the right one is the expression of gene ZEB1 in corresponding cell line. CellLines ZEB1 600MPE 2.8186 AU565 2.783 BT20 2.7817 BT474 2.6433 BT483 2.4994 BT549 3.035 CAMA1 2.718 DU4475 2.8005 HBL100 2.6745 HCC38 3.2884 HCC70 2.597 HCC202 2.8557 HCC1007 2.7794 HCC1008 2.4513 HCC1143 2.8159 HCC1187 2.6372 HCC1428 2.7327 HCC1500 2.7564 HCC1569 2.8093 I've drawn a histogram for

Compare histograms of specific areas of two images? OpenCV

帅比萌擦擦* 提交于 2019-12-12 13:22:41
问题 Basically, I want to be able to compare two histograms, but not of whole images just specific areas. I have image A and have a specific rectangular region on it that I want to compare to another image B. Is there a way to get the histogram of a definable rectangular region on an image? I have the x y position of the rectangular area, as well as it's width and height, and want to get its histogram. I'm using opencv with python. Sorry if that isn't very clear :( (I'm setting up a program that

Fitting a gauss curve to a certain histogram peak in c++

早过忘川 提交于 2019-12-12 12:09:30
问题 I have two questions concerning fitting a gauss curve to histogram peaks. My first question is a very basic one: How can I fit a gauss curve to a entire histogram? Does this only mean that I have to find out and calculate the mean value(µ) and the deviation(ϭ) of the histogram and put them into the formula for the Gauss curve? Would the following example be right?: Assume (just as an example) I have a histogram of an image with 5 colour values. On the X-Axes there are these 5 color values and

Histogram on Lattice

那年仲夏 提交于 2019-12-12 08:07:45
问题 Since hist() of the base R does not report percentages (and the freq=FALSE) does not help either, I turned to lattice . histogram(rnorm(10000)) Please help me with the following: How can I get rid of the box arround the plot? How can I seperately define the cex of the x/y labels and x/y axis? How can I provide custom names to x and y axis? 回答1: This should get you started: library(lattice) histogram(rnorm(10000), main=list( label="Main plot title", cex=1.5), xlab=list( label="Custom x-axis

how to get an vertical histogram of an binary image and based on that histogram segment words from a row

佐手、 提交于 2019-12-12 07:27:14
问题 suppose i have an image in which there are some letters.based on those letters of the image i want to show the vertical projections of histogram of the given image in an axes: i tried imhist('image') but its not showing the projection its only giving a white box on my GUI axes a=imhist(Iedge2); imshow(a,'Parent',handles.axes2); title('HISTOGRAM OF DILATED IMAGE') in this iedge2 is the inverted binary image. after getting the vertical histogram I want to segment the inverted binary image into