histogram

Histogram with marginal boxplot in R

夙愿已清 提交于 2019-12-06 02:32:50
问题 How make matching X-axis in histogram with marginal boxplot? data <- rnorm(1000) nf <- layout(mat = matrix(c(1,2),2,1, byrow=TRUE), height = c(1,3)) layout.show(nf) par(mar=c(5.1, 4.1, 1.1, 2.1)) boxplot(data, horizontal=TRUE, outline=FALSE) hist(data) 回答1: One solution would be to set ylim= in boxplot() to the same range as xlim= in hist() . set.seed(123) data <- rnorm(1000) nf <- layout(mat = matrix(c(1,2),2,1, byrow=TRUE), height = c(1,3)) par(mar=c(5.1, 4.1, 1.1, 2.1)) boxplot(data,

Similar image search using an image

萝らか妹 提交于 2019-12-06 02:32:47
问题 I am working on a project in which the two images will be checked for similarity like 'Google Image Search by image'. I searched through Google and also on various sites including stackoverflow and learnt about various techniques like histogram, sift, fourier transform, pixel grabbing, etc. The things are too complex for me to understand being a beginner in this field. My questions are: From where can i get started?? Is there any book available or a site which give tutorials for learning

Matplotlib: How to make a histogram with bins of equal area?

半世苍凉 提交于 2019-12-06 01:49:42
问题 Given some list of numbers following some arbitrary distribution, how can I define bin positions for matplotlib.pyplot.hist() so that the area in each bin is equal to (or close to) some constant area, A? The area should be calculated by multiplying the number of items in the bin by the width of the bin and its value should be no greater than A. Here is a MWE to display a histogram with normally distributed sample data: import matplotlib.pyplot as plt import numpy as np x = np.random.randn(100

2D histogram with Python

守給你的承諾、 提交于 2019-12-06 01:13:45
I'm trying to plot a 2D histogram in Python using these code from math import * import pylab as p import matplotlib.pyplot as plt import numpy as np x=part.points[:,0] y=part.points[:,1] z=part.points[:,2] H, xedges, yedges = np.histogram2d(x, y, bins=(128,128)) H.shape, xedges.shape, yedges.shape extent = [yedges[0], yedges[-1], xedges[-1], xedges[0]] plt.imshow(H, extent=extent, interpolation='nearest') plt.colorbar() plt.xlabel("x") plt.ylabel("y") plt.show() Every thing works fine: I have a color bar which represent the counts in each cells. The thing is that I would like to have the log

gnuplot rowstacked histogram: how to put sum above bars

左心房为你撑大大i 提交于 2019-12-05 23:44:23
This question is related to gnuplot histogram: How to put values on top of bars . I have a datafile file.dat : x y1 y2 1 2 3 2 3 4 3 4 5 and the gnuplot: set style data histogram; set style histogram rowstacked; plot newhistogram 'foo', 'file.dat' u 2:xtic(1) t col, '' u 3 t col; Now I want to place the sums of columns 2 and 3 above the bars. The obvious solution plot newhistogram 'foo', 'file.dat' u 2:xtic(1) t col, '' u 3 t col, \ '' u ($0-1):($2+$3+0.2):($2+$3) notitle w labels font "Arial,8"; puts the labels in the correct place, but the calculated sum is wrong. That is, in ($0-1):($2+$3+0

How can I convert an RGB histogram into a color spectrum?

只谈情不闲聊 提交于 2019-12-05 22:13:08
How can I convert an RGB histogram of an image to create a histogram showing the combined colors along with correct color wavelength range? Example code: pkg load image f=imread('/tmp/marbles.jpg'); f=uint8(f); %need to convert back to uint8 to show picture %Split into RGB Channels f_red = f(:,:,1); f_green = f(:,:,2); f_blue = f(:,:,3); %Get histValues for each channel [y_f_red, x] = imhist(f_red); [y_f_green, x] = imhist(f_green); [y_f_blue, x] = imhist(f_blue); subplot (2,1,1); imshow(f); subplot (2,1,2); plot(x, y_f_red, 'r', x, y_f_green, 'g', x, y_f_blue, 'b'); Example image along with

matplotlib polar 2d histogram

牧云@^-^@ 提交于 2019-12-05 22:06:08
I am trying to plot some histogrammed data on a polar axis but it wont seem to work properly. An example is below, I use the custom projection found How to make the angles in a matplotlib polar plot go clockwise with 0° at the top? it works for a scatter plot so I think my problem is with the histogram function. This has been driving me nuts all day, does anyone know what I am doing wrong........... import random import numpy as np import matplotlib.pyplot as plt baz = np.zeros((20)) freq = np.zeros((20)) pwr = np.zeros((20)) for x in range(20): baz[x] = random.randint(20,25)*10 freq[x] =

Plot two histograms on the same graph and have their columns sum to 100

≯℡__Kan透↙ 提交于 2019-12-05 21:55:51
I have two sets of different sizes that I'd like to plot on the same histogram. However, since one set has ~330,000 values and the other has about ~16,000 values, their frequency histograms are hard to compare. I'd like to plot a histogram comparing the two sets such that the y-axis is the % of occurrences in that bin. My code below gets close to this, except that rather than having the individual bin values sum to 1.0, the integral of the histogram sums to 1.0 (this is because of the normed=True parameter). How can I achieve my goal? I've already tried manually calculating the % frequency and

Histogram using gnuplot with multiple y-axes

回眸只為那壹抹淺笑 提交于 2019-12-05 20:19:24
I could not find a solution to the following issue I am facing. All SO questions on multi-axis talk about line plots, but I am looking for histograms. The y-range for the bars are different, so one set of bars are not really seen because of the scale. Here is the data: Metric A B M1 0.613416301 0.543734744 M2 0.000195961 0.000100190 Here is the MWE: reset set term postscript eps size 5.5,4.5 enhanced color font 'Arial-Bold' 25 set out 'histplot.eps' set key right set style histogram cluster gap 2 set style data histograms set style fill pattern 1.00 border set y2range [0.0001:0.0002] plot

Histogram of Image in iPhone

萝らか妹 提交于 2019-12-05 19:59:43
I am looking for a way to get a histogram of an image on the iPhone. The OpenCV library is way too big to be included in my app (OpenCV is about 70MB compiled), but I can use OpenGL. However, I have no idea on how to do either of these. I have found how to get the pixels of the image, but cannot form a histogram. This seems like it should be simple, but I don't know how to store uint8_t into an array. Here is the relevant question/answer for finding pixels: Getting RGB pixel data from CGImage The uint8_t* is just a pointer to a c array containing the bytes of the given color, i.e. {r, g, b, a}