histogram

matplotlib stepfilled hist in y-log scale don't show correctly

旧时模样 提交于 2019-12-07 07:40:18
问题 I have a problem displaying histograms in matplotlib when both options histtype='stepfilled' and log=True are used. I had this problem in matplotlib version 1.1.0 and found that this is still present in version 1.2.0. Unfortunately I don't have the rights to post images, but you can check out this behaviour with this simple code: import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt mu, sigma = 200, 25 x = mu + sigma*np.random.randn(10000) n, bins, patches = plt.hist(x,

adding error bar to histogram in gnuplot

巧了我就是萌 提交于 2019-12-07 06:57:58
问题 I have data file which looks like this #col 1 2 3 4 5 6 7 #bench #these are max and min values #mark #bar1 #bar2 #for the prevoius 2 values NOSHARE.2 43032 139412 100 45000 130000 140000 FALSE_SHARE.2 7035 24101 5000 7500 24100 25000 SHAREDVAR.2 11316 10248 10000 12000 10000 12000 I am able to generate a graph using gnuplot which looks like this I need to add max and min value as an error bar to each bar Heres my gnuplot script set output "truevsfalse.png" set title " TRUE VS FALSE SHARING "

facecolor kwarg for Matplotlib stacked histogram

*爱你&永不变心* 提交于 2019-12-07 06:19:50
问题 I am having trouble controlling the color and linestyle of histogram plotted using Matplotlib's hist function with stacked=True . For a single non-stacked histogram, I have no trouble: import pylab as P mu, sigma = 200, 25 x0 = mu + sigma*P.randn(10000) n, bins, patches = P.hist( x0, 20, histtype='stepfilled', facecolor='lightblue' ) However, when I introduce additional histograms, import pylab as P mu, sigma = 200, 25 x0 = mu + sigma*P.randn(10000) x1 = mu + sigma*P.randn(7000) x2 = mu +

How to histogram day-of-week, and have string labels

萝らか妹 提交于 2019-12-07 05:48:26
问题 I have a data-frame of dates (Date object); see bottom. I'm trying to convert them to day-of-week and then draw a histogram, but ideally where the labels are 'Monday'...'Sunday' (not numeric) I have two distinct problems: It's easy to convert a Date object to day-of-week, but the result is string or numeric, not an object. When I get a histogram, the bins and labels are wrong (see below). If I use weekdays(dat) , the output is string ("Monday"...) which cannot be used in hist() .

ggplot2 density histogram with width=.5, vline and centered bar positions

主宰稳场 提交于 2019-12-06 20:36:24
I want a nice density (that sums to 1) histogram for some discrete data. I have tried a couple of ways to do this, but none were entirely satisfactory. Generate some data: #data set.seed(-999) d.test = data.frame(score = round(rnorm(100,1))) mean.score = mean(d.test[,1]) d1 = as.data.frame(prop.table(table(d.test))) The first gives the right placement of bars -- centered on top of the number -- but the wrong placement of vline() . This is because the x-axis is discrete (factor) and so the mean is plotted using the number of levels, not the values. The mean value is .89. ggplot(data=d1, aes(x=d

histogram without vertical lines in Mathematica

随声附和 提交于 2019-12-06 19:21:12
问题 I am trying to make an histogram without vertical lines. I'd like to have a plot which looks like a function. Like this: The same question has been asked for R before ( histogram without vertical lines ) but I'm on Mathematica. I have been looking into the ChartStyle options without success. 回答1: There probably are ways to do this by fiddling with EdgeForm[] and FaceForm[] in Histogram , but I've found it simpler to roll one on my own, whenever I need it. Here's a very simple and quick

Detect spots empty parking OPENCV

喜夏-厌秋 提交于 2019-12-06 18:05:32
问题 I want to apply a detector algorithm to detect empty areas of parking and I have read about SIFT and SURF, but I can't quite understand it. I have seen examples of comparison between two images, but that's not what I want. Could you explain about how to use SURF or SIFT on the issue of detecting empty spots on parking? I have also read about color histogram, can I have some documentation about it? I am working with OpenCV python 2.4.9 and 2.7 回答1: It depends on what you exactly want to

geom_text works for histogram in R?

混江龙づ霸主 提交于 2019-12-06 16:42:11
Wondering if geom_text works for hist ? Tried following code and it seems no effect. I just want to show label (the number of elements belonging to a specific histogram bucket), when plotting each bar for each histogram bucket. Any solutions are appreciated. Thanks. p <- hist(df$foo, main="title",xlab="foo") p + geom_text() Edit 1 , tried geom_bar , here is my code and it seems not working well, since I expect a number labelled on each bar. In the diagram, it only shows 2.5, 5, 7.5 and 10, I expect to show 1, 2, 3, ..., 9, 10 for each bar. g <- ggplot(df, aes(df$foo)) g + geom_bar() regards,

get histogram data from Mat , opencv android

隐身守侯 提交于 2019-12-06 15:51:22
问题 i am working on an android project using opencv , i am creating a histogram for a black and white image (1-0 values on image file) . i am following some tutorials i found on internet on how to create the histogram . i am doing something like this ArrayList<Mat> list = new ArrayList<Mat>(); list.add(mRgba); MatOfInt channels = new MatOfInt(0); Mat hist= new Mat(); MatOfInt histSize = new MatOfInt(25); MatOfFloat ranges = new MatOfFloat(0f, 1f); Imgproc.calcHist(list, channels, new Mat(), hist,

Creating a Python Histogram without Pylab

主宰稳场 提交于 2019-12-06 15:23:09
问题 I have to generate a list of random numbers with a gaussian distribution (I'm able to do this) and then take those numbers and plot them in a histogram. My problem is that I'm supposed to do this without using the built-in histogram function within pylab (or any other package for that matter) and I'm at a complete loss. I've been looking on-line and I haven't found anything that explains how I would go about this, does any of you know what I could do? Thanks in advance. 回答1: Let's assume you