bins

Label histogram by bins matplotlib [duplicate]

坚强是说给别人听的谎言 提交于 2019-12-11 03:01:45
问题 This question already has answers here : Matplotlib - label each bin (2 answers) Closed 2 years ago . I have a histogram in which I want to label the x-axis by bins. The histogram is plotted as a log log graph, but the bins are very specific. The graph: The bins: bins = [0, 0.035, 0.07, 0.15, 0.5, 1, 3, 10, 40] Is there any way I can do this? I believe it would also require getting rid of the current x-axis labels. 回答1: I wrote an example code for you. Basically, all you need was 'set_xticks'

Groupby bins and aggregate in R

旧城冷巷雨未停 提交于 2019-12-11 02:42:50
问题 I have data like (a,b,c) a b c 1 2 1 2 3 1 9 2 2 1 6 2 where 'a' range is divided into n (say 3) equal parts and aggregate function calculates b values (say max) and grouped by at 'c' also. So the output looks like a_bin b_m(c=1) b_m(c=2) 1-3 3 6 4-6 NaN NaN 7-9 NaN 2 Which is MxN where M=number of a bins, N=unique c samples or all range How do I approach this? Can any R package help me through? 回答1: There would be easier ways. If your dataset is dat res <- sapply(split(dat[, -3], dat$c),

How do i get all the numbers of fft bins in a defined frequency band?

和自甴很熟 提交于 2019-12-11 02:39:44
问题 I use the matlab software. To my question. I have a audio signal, on which i am applying a STFT. I take a segment (46 ms, specifially chosen) out of my signal y(audio signal) and use a FFT on it. Then i go to the next segment, until to end of my audio signal. My WAV-File is 10.8526 seconds long. If I have a sample frequency of 44100Hz, this means my y is 10.8526*fs = 478599.66 which is shown in the workspace as 478 6000 x2 double . The length of my fft is 2048 . My signal are differentiated

Unable to align bins in a histogram of datetime objects using the hist() function

本小妞迷上赌 提交于 2019-12-10 13:54:05
问题 So I am trying to plot a histogram of some datetime objects, but i can never get the bins to line up with the bars. My code is below: I start by importing my stuff and declaring the start, end and a one day object: import datetime import matplotlib.pyplot as plt end = datetime.date(2017,5,14) start = datetime.date(2017,5,8) one_day = datetime.timedelta(days = 1) Then I declare an arbitrary list of dates: date_list = [datetime.date(2017,5,14), datetime.date(2017,5,14), datetime.date(2017,5,14)

Creating 2D bins in R

巧了我就是萌 提交于 2019-12-04 14:32:42
问题 I have coordinate data in R, and I would like to determine a distribution of where my points lie. The entire space of points is a square of side length 100. I'd like to assign points to different segments on the square, for example rounded to the nearest 5. I've seen examples using cut and findinterval but i'm not sure how to use this when creating a 2d bin. Actually, what I want to be able to do is smooth the distribution so there are not huge jumps in between neighboring regions of the grid

Normalizing histogram bins in gnuplot

戏子无情 提交于 2019-12-04 09:38:28
问题 I'm trying to plot a histogram whose bins are normalized by the number of elements in the bin. I'm using the following binwidth=5 bin(x,width)=width*floor(x/width) + binwidth/2.0 plot 'file' using (bin($2, binwidth)):($4) smooth freq with boxes to get a basic histogram, but I want the value of each bin to be divided by the size of the bin. How can I go about this in gnuplot, or using external tools if necessary? 回答1: In gnuplot 4.4, functions take on a different property, in that they can

Creating 2D bins in R

廉价感情. 提交于 2019-12-03 09:03:35
I have coordinate data in R, and I would like to determine a distribution of where my points lie. The entire space of points is a square of side length 100. I'd like to assign points to different segments on the square, for example rounded to the nearest 5. I've seen examples using cut and findinterval but i'm not sure how to use this when creating a 2d bin. Actually, what I want to be able to do is smooth the distribution so there are not huge jumps in between neighboring regions of the grid. For example (this is just meant to illustrate the problem): set.seed(1) x <- runif(2000, 0, 100) y <-

Matplotlib histogram with collection bin for high values

梦想与她 提交于 2019-12-03 04:53:03
问题 I have an array with values, and I want to create a histogram of it. I am mainly interested in the low end numbers, and want to collect every number above 300 in one bin. This bin should have the same width as all other (equally wide) bins. How can I do this? Note: this question is related to this question: Defining bin width/x-axis scale in Matplotlib histogram This is what I tried so far: import matplotlib.pyplot as plt import numpy as np def plot_histogram_01(): np.random.seed(1) values_A

Normalizing histogram bins in gnuplot

做~自己de王妃 提交于 2019-12-03 03:28:59
I'm trying to plot a histogram whose bins are normalized by the number of elements in the bin. I'm using the following binwidth=5 bin(x,width)=width*floor(x/width) + binwidth/2.0 plot 'file' using (bin($2, binwidth)):($4) smooth freq with boxes to get a basic histogram, but I want the value of each bin to be divided by the size of the bin. How can I go about this in gnuplot, or using external tools if necessary? In gnuplot 4.4, functions take on a different property, in that they can execute multiple successive commands, and then return a value (see gnuplot tricks ) This means that you can

Python Pandas Create New Bin/Bucket Variable with pd.qcut

☆樱花仙子☆ 提交于 2019-12-02 23:48:16
How do you create a new Bin/Bucket Variable using pd.qut in python? This might seem elementary to experienced users but I was not super clear on this and it was surprisingly unintuitive to search for on stack overflow/google. Some thorough searching yielded this ( Assignment of qcut as new column ) but it didn't quite answer my question because it didn't take the last step and put everything into bins (i.e. 1,2,...). In Pandas 0.15.0 or newer, pd.qcut will return a Series, not a Categorical if the input is a Series (as it is, in your case) or if labels=False . If you set labels=False , then