histogram

How do I plot a 32-Bin Histogram for a Grayscale Image in Python using OpenCV

柔情痞子 提交于 2020-01-23 22:08:32
问题 I have been having difficulty trying to generate a histogram for a 640x480 grayscale image I am working with. I am using Python 2.7.3, OpenCV 2.4.6 (Python bindings) and Numpy The image below was generated from the same image, using an executable software tool (programmed in C++) The properties for this histogram were: bins = 50 hist_width = 250 normalised_height_max = 50 The image specs are therefore 250x50 I have consulted this documentation: Histogram Calculation in OpenCV http://docs

Get data points from a histogram in Python

怎甘沉沦 提交于 2020-01-23 05:22:23
问题 I made a histogram of the 'cdf' (cumulative distribution) of a function. The histogram is basically No. of counts vs. luminosity. Now, how do I extract data points from a histogram? I need actual values of Luminosities. I am using Matplotlib in Python, and any online book, example, tutorial etc is not helping. l= [ss.gammainccinv(aa+1, u[i]) for i in a] #is the cdf function plt.hist(l, 50, histtype= 'step', align='mid') #is the histogram plt.show() I am not sure if I should align the bins to

What does the right parameter do when creating a histogram in R?

心不动则不痛 提交于 2020-01-22 12:31:46
问题 I am trying to figure out what the right parameter in the hist function in R does. The documentation is unfortunately unclear to someone without a deep understanding of statistics such as myself. The documentation as stated online is: right logical; if TRUE, the histograms cells are right-closed (left open) intervals. What does it mean to be right-closed (or left open) intervals? 回答1: When creating histograms of non-categorial data (things like pH, temperature, etc.), you need to specify

Calculating peaks in histograms or density functions

雨燕双飞 提交于 2020-01-22 12:20:05
问题 There seem to be a lot of "peaks in density function" threads already, but I don't see one addressing this point specifically. Sorry to duplicate if I missed it. My problem: Given a vector of 1000 values (sample attached), I would like to identify the peaks in the histogram or density function of the data. From the image of the sample data below , I can see peaks in the histogram at ~0, 6200, and 8400. But I need the obtain the exact values of these peaks, preferably in a simple procedure as

How to correctly generate a 3d histogram using numpy or matplotlib built in functions in python?

ぐ巨炮叔叔 提交于 2020-01-21 12:27:04
问题 This is more of a general question about 3d histogram creation in python. I have attempted to create a 3d histogram using the X and Y arrays in the following code import matplotlib import pylab import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d.axes3d import Axes3D from matplotlib import cm def threedhist(): X = [1, 3, 5, 8, 6, 7, 1, 2, 4, 5] Y = [3, 4, 3, 6, 5, 3, 1, 2, 3, 8] fig = pylab.figure() ax = Axes3D(fig) ax.hist([X, Y], bins=10, range=[[0, 10], [0, 10]])

How to correctly generate a 3d histogram using numpy or matplotlib built in functions in python?

…衆ロ難τιáo~ 提交于 2020-01-21 12:27:02
问题 This is more of a general question about 3d histogram creation in python. I have attempted to create a 3d histogram using the X and Y arrays in the following code import matplotlib import pylab import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d.axes3d import Axes3D from matplotlib import cm def threedhist(): X = [1, 3, 5, 8, 6, 7, 1, 2, 4, 5] Y = [3, 4, 3, 6, 5, 3, 1, 2, 3, 8] fig = pylab.figure() ax = Axes3D(fig) ax.hist([X, Y], bins=10, range=[[0, 10], [0, 10]])

Group the variable according to its value and get a histogram

你离开我真会死。 提交于 2020-01-17 15:18:49
问题 I'm trying to group the variable according to its values and get a histogram. For example, this is my data: r <-c(1,899,1,2525,763,3,2,2,1863,695,9,4,2876,1173,1156,5098,3,3876,1,1, 3023,76336,13,003,9898,1,10,843,10546,617,1375,1,1,5679,1,21,1,13,6,28,1,14088,682) I want to group r by its value, like: 1-5, 5-10, 10-100, 100-500 and more than 500. And then I want to get a histogram which the x axis is in the type of interval (1-5,5-10,10-100,100-500 and more than 500) . How to solve that? If

gnuplot - Make a histogram with data located in multiple files

心已入冬 提交于 2020-01-17 12:39:07
问题 I know how to make a histogram in gnuplot, but all the instructions I've seen are valid when the data is located in a single file . My problem is that my data spans several files . Is there any way to do this with gnuplot ? 回答1: Not really. Gnuplot is really only good at dealing with one file at a time. However, there are many useful external tools which could combine the files together for you: plot "<magic_external_tool file1 file2 file3 file4 ..." ... of course your choice of external tool

gnuplot - Make a histogram with data located in multiple files

老子叫甜甜 提交于 2020-01-17 12:39:05
问题 I know how to make a histogram in gnuplot, but all the instructions I've seen are valid when the data is located in a single file . My problem is that my data spans several files . Is there any way to do this with gnuplot ? 回答1: Not really. Gnuplot is really only good at dealing with one file at a time. However, there are many useful external tools which could combine the files together for you: plot "<magic_external_tool file1 file2 file3 file4 ..." ... of course your choice of external tool

Creating legend in geom_histogram for elements created from geom_vline

会有一股神秘感。 提交于 2020-01-16 18:47:50
问题 Here is an example data set: structure(list(Age = c(6L, 7L, 5L, 6L, 7L, 9L,6L, 7L, 5L, 6L, 7L, 9L,6L, 7L, 5L, 6L, 7L, 9L), Year = c(2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011 )), .Names = c("Age", "Year"), row.names = c(NA, 6L), class = "data.frame") I am trying to create a legend that will show the three components that I list in my geom_vline command below. I've read several examples on s.overflow but nothing seems to be