histogram

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

how can I visualize a histogram with promdash or grafana

久未见 提交于 2019-12-03 04:50:26
I'm attracted to prometheus by the histogram (and summaries) time-series, but I've been unsuccessful to display a histogram in either promdash or grafana. What I expect is to be able to show: a histogram at a point in time, e.g. the buckets on the X axis and the count for the bucket on the Y axis and a column for each bucket a stacked graph of the buckets such that each bucket is shaded and the total of the stack equals the inf bucket A sample metric would be the response time of an HTTP server. Grafana v5+ provides direct support for representing Prometheus histograms as heatmap. http://docs

Time-series histogram

倾然丶 夕夏残阳落幕 提交于 2019-12-03 03:37:29
Is it possible to create a time-series histogram like the one described in this presentation (slides 36-39) using either R or D3.js? Or is there a better way to show bucketed data as a time series? Edit: Here is some pre-bucketed sample data . Ideally, D3 or R would do the bucketing by itself. And yes, if it wasn't clear, I understand that I could write this myself. I'm just wondering if there's already a package that does this and I just haven't come across it yet. Thanks! Here is one possible solution using R and ggplot2. Your data, ready to paste into R console: dat = structure(list(date =

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

Image detection features: SIFT, HISTOGRAM and EGDE

拟墨画扇 提交于 2019-12-03 00:43:49
I am working on developing a object classifier by using 3 different features i.e SIFT, HISTOGRAM and EGDE. However these 3 features have different dimensional vector e.g. SIFT = 128 dimension. HIST = 256. Now these features cannot be concatenated into once vector due to different sizes. What I am planning to do but I am not sure if it is going to be correct way is this: For each features i train the classifier separately and than i apply classification separately for 3 different features and than count the majority and finally declare the image with majority votes. Do you think this is a

How to recognize histograms with a specific shape in opencv / python

北战南征 提交于 2019-12-03 00:36:45
I want to segment images (from magazines) in text and image parts. I have several histograms for several ROIs in my picture. I use opencv with python (cv2). I want to recognize histograms that look like this http://matplotlib.sourceforge.net/users/image_tutorial-6.png as it is a typical shape for a text region. How can I do that? Edit: Thank you for your help so far. I compared the histograms I got from my ROIs to a sample histogram I provided: hist = cv2.calcHist(roi,[0,1], None, [180,256],ranges) compareValue = cv2.compareHist(hist, samplehist, cv.CV_COMP_CORREL) print "ROI: {0},

R Normalize then plot two histograms together in R

坚强是说给别人听的谎言 提交于 2019-12-03 00:14:41
I realize there have been several posts for people asking how to plot two histograms together side by side (as in one plot with the bars next to each other) and overlaid in R and also on how to normalize data. Following the advice that I've found, I'm able to do one or the other, but not both operations. Here's the setup. I have two data frames of different lengths and would like to plot the volume of the objects in each df as a histogram. Eg how many in data frame 1 are between .1-.2 um^3 and compare it with how many in data frame 2 are between .1 and .2 um^3 and so on. Overlaid or Side by

Python: Creating a 2D histogram from a numpy matrix

只愿长相守 提交于 2019-12-02 23:28:19
I'm new to python. I have a numpy matrix, of dimensions 42x42, with values in the range 0-996. I want to create a 2D histogram using this data. I've been looking at tutorials, but they all seem to show how to create 2D histograms from random data and not a numpy matrix. So far, I have imported: import numpy as np import matplotlib.pyplot as plt from matplotlib import colors I'm not sure if these are correct imports, I'm just trying to pick up what I can from tutorials I see. I have the numpy matrix M with all of the values in it (as described above). In the end, i want it to look something

How do I count the frequencies of the letters in user input?

我只是一个虾纸丫 提交于 2019-12-02 22:18:51
问题 How do I count the frequency of letters that appear in the word "supercaliforniamightly" when the user enters a word like that in Ruby, and print out stars or asterisks to count the number of letters that appear? Here's my code: puts "Enter string: " text= gets.chomp text.downcase! words = text.split(//) frequencies = Hash.new(0) words.each{|item| frequencies[item] +=1} frequencies = frequencies.sort_by{ |item, amount| amount} frequencies.reverse! frequencies.each do |item, amount| puts item

Drawing Histogram in OpenCV-Python

£可爱£侵袭症+ 提交于 2019-12-02 20:40:32
I was just trying to draw histogram using new OpenCV Python interface ( cv2 ). Below is the code i tried: import cv2 import numpy as np import time img = cv2.imread('zzz.jpg') h = np.zeros((300,256,3)) b,g,r = cv2.split(img) bins = np.arange(256).reshape(256,1) color = [ (255,0,0),(0,255,0),(0,0,255) ] for item,col in zip([b,g,r],color): hist_item = cv2.calcHist([item],[0],None,[256],[0,255]) cv2.normalize(hist_item,hist_item,0,255,cv2.NORM_MINMAX) hist=np.int32(np.around(hist_item)) pts = np.column_stack((bins,hist)) cv2.polylines(h,[pts],False,col) h=np.flipud(h) cv2.imshow('colorhist',h)