histogram

d3.js bar charts transitioning between multiple csv files

元气小坏坏 提交于 2019-12-06 15:13:11
I'm working on visualizing term frequencies for some Twitter data I've collected about the Winter Olympics. I'd like to make a histogram using d3 that will visualize these counts and allow users to toggle between datasets for each day of the games. I have an initial visualization I'm fairly happy with here , modified from this example. However, when clicking the "Update" button in the lower right corner, this simply overlays a new histogram on top of the existing one. Both datasets are CSV's, and there are seven of them total that I'd like to be able to toggle through. I've searched Stack

How to calculate image histogram of 32bit floating point image in OPenCV

自作多情 提交于 2019-12-06 14:49:55
I want to calculate histogram of an image hows pixels are of type 32F (32 bit floating point). What should be the parameter values of "calcHist" function for: - dims - bins - range Well I've done this many times. Something like so: cv::Mat matSrc; // this is a CV_32FC1 normalised image int nHistSize = 65536; float fRange[] = { 0.0f, 1.0f }; const float* fHistRange = { fRange }; cv::Mat matHist; cv::calcHist(&matSrc, 1, 0, cv::Mat(), matHist, 1, &nHistSize, &fHistRange); As it says in the documentation describing the source arrays: Source arrays. They all should have the same depth, CV_8U or CV

Skin detection from hue-saturation histogram - OpenCV Python

泪湿孤枕 提交于 2019-12-06 12:35:59
问题 I'm working on a little program in python to estimate the direction of pointing gestures with 2D picture from a monocular camera and I'm using OpenCV 2.3. I know it's a bit tricky but I'm motivated! :) My approach is fisrt to use the face detection to detect an area into which I'm sure there is a lot of skin: img = cv2.imread("/home/max/recordings/cameras/imageTEST.jpg",1) img_hsv = cv2.cvtColor(img,cv2.COLOR_BGR2HSV) hc1 = cv2.CascadeClassifier("/home/max/haarcascade_frontalface_alt.xml")

Most efficient histogram code in python

半世苍凉 提交于 2019-12-06 12:31:31
问题 I've seen a number of questions on making histograms in clean one-liners, but I haven't yet found anyone trying to make them as efficiently as possible. I'm currently creating a lot of tfidf vectors for a search algorithm, and this involves creating a number of histograms and my current code, while being very short and readable is not as fast as I would like. Sadly, I've tried a number of other methods that turned out far slower. Can you do it faster? cleanStringVector is a list of strings

R histogram showing time spent in each bin

谁都会走 提交于 2019-12-06 11:39:03
问题 I'm trying to create a plot similar to the ones here: Basically I want a histogram, where each bin shows how long was spent in that range of cadence (e.g 1 hour in 0-20rpm, 3 hours in 21-40rpm, etc) library("rjson") # 3rd party library, so: install.packages("rjson") # Load data from Strava API. # Ride used for example is http://app.strava.com/rides/13542320 url <- "http://app.strava.com/api/v1/streams/13542320?streams[]=cadence,time" d <- fromJSON(paste(readLines(url))) Each value in d

cumulative traffic by time of day with elasticsearch

谁说胖子不能爱 提交于 2019-12-06 11:33:01
i'm receiving requests/events from a large number of client applications. i'd like to use elasticsearch to find out when my highest traffic point is. one thing i've tried is a filter aggregation with a nested histogram and then a nested "terms" aggregation that gets the distinct hour of the day via a script field. the following is my attempt, and it performs terribly (as I'd expect since I'm executing a script per document). { "aggs": { "sites_within_range": { "filter" : { "range" : { "occurred" : { "gt" : "now-1M" } } }, "aggs": { "sites_over_time": { "date_histogram": { "field": "occurred",

D3 time and date histogram

蹲街弑〆低调 提交于 2019-12-06 10:31:07
问题 I'm attempting to make a histogram using primarily time and date data, provided in a json file (along with other info) in this format: 2014-03-01 00:18:00. I've looked at http://bl.ocks.org/mbostock/3048450 as an example, but I haven't managed to crack it. The key part seems to be this: var data = d3.layout.histogram() .bins(x.ticks(20)) (dataset.timestamp); When I view my code in the browser it gives "TypeError: data is undefined", and refers to d3.v3.js line 5878. Assuming I fix that error,

Probability distribution function in Python

删除回忆录丶 提交于 2019-12-06 10:26:20
问题 I know how to create an histogram in Python, but I would like that it is the probability density distribution. Let's start with my example. I have an array d , with a size of 500000 elements. With the following code I am building a simple histogram telling me how many elements of my array d are between every bin. max_val=log10(max(d)) min_val=log10(min(d)) logspace = np.logspace(min_val, max_val, 50) H=hist(select,bins=logspace,histtype='step') The problem is that this plot is not what I want

Producing histogram Map for IntStream raises compile-time-error

扶醉桌前 提交于 2019-12-06 10:24:41
问题 I'm interested in building a Huffman Coding prototype. To that end, I want to begin by producing a histogram of the characters that make up an input Java String . I've seen many solutions on SO and elsewhere (e.g:here that depend on using the collect() methods for Stream s as well as static imports of Function.identity() and Collectors.counting() in a very specific and intuitive way. However, when using a piece of code eerily similar to the one I linked to above: private List<HuffmanTrieNode>

how to use a log scale for y-axis of histogram in R?

别来无恙 提交于 2019-12-06 08:35:15
I have a large dataset with the lifespan of threads on an discussion board. I want a histogram that shows the distribution of lifespan, so I did this: dall <- read.csv("lifespan.csv") colnames(dall) <- c("thread.id", "seconds.alive", "start.time") hist(dall$seconds.alive) which generated this hard to read image: My questions are a) is changing y-axis to a log-scale a good way to make it more readable? Apparently some people think is a bad idea to change y-axis to log. b) how do I do that? I would try using hist(log10(dall$seconds.alive)) instead. Also try specifying breaks=100 or smaller