histogram

Normalizing faceted histograms separately in ggplot2

南笙酒味 提交于 2019-11-29 18:03:00
问题 My questions is similar to Normalizing y-axis in histograms in R ggplot to proportion but I'd like to add to it a bit. In general, I have 6 histograms in a 2x3 facet design, and I'd like to normalize each of them separately. I'll try to make a sample data set here to give an idea: hvalues=c(3,1,3,2,2,5,1,1,12,1,4,3) season=c("fall","fall","fall","fall","winter","winter","winter","winter","summer","summer","summer","summer") year=c("year 1","year 1","year 2","year 2","year 1","year 1","year 2"

pylab histogram get rid of nan

末鹿安然 提交于 2019-11-29 17:07:07
问题 I have a problem with making a histogram when some of my data contains "not a number" values. I can get rid of the error by using nan_to_num from numpy, but than i get a lot of zero values which mess up the histogram as well. pylab.figure() pylab.hist(numpy.nan_to_num(A)) pylab.show() So the idea would be to make another array in which all the nan values are gone, or to just mask them in the histogram in some way (preferrably with some builtin method). 回答1: Remove np.nan values from your

Are there functions to retrieve the histogram counts of a Series in pandas?

我与影子孤独终老i 提交于 2019-11-29 16:57:43
问题 There is a method to plot Series histograms, but is there a function to retrieve the histogram counts to do further calculations on top of it? I keep using numpy's functions to do this and converting the result to a DataFrame or Series when I need this. It would be nice to stay with pandas objects the whole time. 回答1: If your Series was discrete you could use value_counts: In [11]: s = pd.Series([1, 1, 2, 1, 2, 2, 3]) In [12]: s.value_counts() Out[12]: 2 3 1 3 3 1 dtype: int64 You can see

Change matplotlib.bar Order in python 2.7 [duplicate]

会有一股神秘感。 提交于 2019-11-29 16:37:18
This question already has an answer here: Pyplot sorting y-values automatically 2 answers In this example: import matplotlib.pyplot as plt colors = ['white', 'orange', 'green', 'purple'] rates = ['5','5','4','3'] plt.bar(colors, rates) the bars in the plot are ordered by the alphabetic order. How do I make them to show in the same order as they are in the code (from highest to lowest rate)? Matplotlib 2.1 provides the new option to use strings as input to its plotting functions - called "categoricals". This is a new feature and not yet completely working. One caveat is that strings are

Centering histogram bins and setting percentage range in Matlab

余生长醉 提交于 2019-11-29 16:20:38
I'm doing data-analysis in Matlab and I'm plotting the frequencies of discrete values (1-15) into a histogram on Matlab. I would like to center the bins so that the center of 1st bin is on value 1, center of the 2nd bin is on value 2, etc. Also I would like to get percentage range for the Y-axis. Any quick ideas how to do this? Here is a picture highlighting my question: Start by using hist with your expected centers. Then use bar and xlabel to display the histogram with the y axis the way you want: dat = randi(15,100,1); centers = 1:15; counts = hist(dat,centers); pcts = 100 * counts / sum

openCV Gaussian blur/smoothing of 3D Matrix/Histogram

廉价感情. 提交于 2019-11-29 15:54:05
I have a (3D) Histogram which I like to apply Gaussian smoothing on: cv::MatND Hist; In the 1D and 2D cases I blur it via: cv::GaussianBlur(Hist, Hist, cv::Size(1,3), 1.0);// 1D case cv::GaussianBlur(Hist, Hist, cv::Size(3,3), 1.0);// 2D case But I struggle to apply Gaussian blurring in the 3D case. Has anyone got an idea how to attempt this? Try use separable kernels like shown here: http://www.programming-techniques.com/2013/03/gaussian-blurring-using-separable.html 来源: https://stackoverflow.com/questions/18020438/opencv-gaussian-blur-smoothing-of-3d-matrix-histogram

how to create a histogram in java [duplicate]

心已入冬 提交于 2019-11-29 15:30:44
Possible Duplicate: how to convert numbers into symbols in java? for example instead of 2 to **, or 3 to *** etc. How can I convert numbers into a histogram ? The histogram should display the bar graphs from 2-12 based upon how many times that value was rolled. currently my output is like the second pic but is suppose to look like the first one. thanks. public static void main(String[] args) { // TODO code application logic here System.out.print("Please enter how many times you want to roll two dice?"); Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int [] rolls = new int[n];

Plot timeseries of histograms in Python

走远了吗. 提交于 2019-11-29 14:37:47
问题 I'm trying to plot a time-series of histograms in Python. There has been a similar question about this, but in R. So, basically, I need the same thing, but I'm really bad in R. There are usually 48 values per day in my dataset. Where - 9999 represents missing data. Here's the sample of the data. I started with reading in the data and constructing a pandas DataFrame . import pandas as pd df = pd.read_csv('sample.csv', parse_dates=True, index_col=0, na_values='-9999') print df <class 'pandas

GNUPLOT - Two columns histogram with values on top of bars

醉酒当歌 提交于 2019-11-29 14:33:43
yesteraday I made a similar question ( this one ). I could not display the value on top of bar in a gnuplot histogram. I lost many time because I couldn't find really good documentation about it, and I only can find similar issues on differents websites. I lost many time with that but fortunately someone give me the solution. Now I am having a similar issue with an histogram with two bars, in which I have to put on top of both bars its value. I am quite near, or that is what I think, but I can't make it work properly. I am changing the script and regenerating the graph many times but I am not

Simple histogram generation of integer data in C#

萝らか妹 提交于 2019-11-29 14:05:57
问题 As part of a test bench I'm building, I'm looking for a simple class to calculate a histogram of integer values (number of iterations taken for an algorithm to solve a problem). The answer should be called something like this: Histogram my_hist = new Histogram(); for( uint i = 0; i < NUMBER_OF_RESULTS; i++ ) { myHist.AddValue( some_result ); } for( uint j = 0; j < myHist.NumOfBins; j++ ) { Console.WriteLine( "{0} occurred {1} times", myHist.BinValues[j], myHist.BinCounts[j] ); } I was