histogram

gnuplot rowstacked histogram: how to put sum above bars

[亡魂溺海] 提交于 2020-01-02 08:06:21
问题 This question is related to gnuplot histogram: How to put values on top of bars. I have a datafile file.dat : x y1 y2 1 2 3 2 3 4 3 4 5 and the gnuplot: set style data histogram; set style histogram rowstacked; plot newhistogram 'foo', 'file.dat' u 2:xtic(1) t col, '' u 3 t col; Now I want to place the sums of columns 2 and 3 above the bars. The obvious solution plot newhistogram 'foo', 'file.dat' u 2:xtic(1) t col, '' u 3 t col, \ '' u ($0-1):($2+$3+0.2):($2+$3) notitle w labels font "Arial

How to show percent labels on histogram bars using ggplot2

我的梦境 提交于 2020-01-02 07:26:08
问题 I have seen lots of question regarding converting count on y axis into percent but must of them are in bar plot. I want to do similar thing in histogram but not able to show the labels on the bar clearly. Please tell me where I am doing wrong. x = runif(100, min = 0, max = 10) data1 <- data.frame(x = x) ggplot(aes(x = x), data = data1)+ geom_histogram(aes(y = (..count..)/sum(..count..)), bins = 10, breaks = seq(0,10,1), fill = "blue", col = "black")+ geom_text(aes(y = ((..count..)/sum(..count

gnuplot : using a logarithmic axis for a histogram

て烟熏妆下的殇ゞ 提交于 2020-01-02 06:22:16
问题 I have a data file that I am creating a histogram from. The data file is : -0.1 0 0 JANE 1 1 1 BILL 2 2 1 BILL 1 3 1 BILL 6 4 0 JANE 35 5 0 JANE 9 6 1 BILL 4 7 1 BILL 24 8 1 BILL 28 9 1 BILL 9 10 0 JANE 16 11 1 BILL 4 12 0 JANE 45 13 1 BILL My gnuplot script is : file='test.txt' binwidth=10 bin(x,width)=width*floor(x/width) set boxwidth 1 plot file using (bin($1,binwidth)):(1.0) smooth freq with boxes, \ file using (1+(bin($2,binwidth))):(1.0) smooth freq with boxes I would like to plot this

Pandas: plotting two histograms on the same plot

半城伤御伤魂 提交于 2020-01-02 04:46:05
问题 I would like to have 2 histograms to appear on the same plot (with different colors, and possibly differente alphas). I tried import random x = pd.DataFrame([random.gauss(3,1) for _ in range(400)]) y = pd.DataFrame([random.gauss(4,2) for _ in range(400)]) x.hist( alpha=0.5, label='x') y.hist(alpha=0.5, label='y') x.plot(kind='kde', style='k--') y.plot(kind='kde', style='k--') plt.legend(loc='upper right') plt.show() This produces the result in 4 different plots. How can I have them on the

ggplot2: Reading maximum bar height from plot object containing geom_histogram

强颜欢笑 提交于 2020-01-02 03:29:08
问题 Like this previous poster, I am also using geom_text to annotate plots in gglot2. And I want to position those annotations in relative coordinates (proportion of facet H & W) rather than data coordinates. Easy enough for most plots, but in my case I'm dealing with histograms. I'm sure the relevant information as to the y scale must be lurking in the plot object somewhere (after adding geom_histogram ), but I don't see where. My question: How do I read maximum bar height from a faceted ggplot2

r : ecdf over histogram

元气小坏坏 提交于 2020-01-01 06:43:47
问题 in R, with ecdf I can plot a empirical cumulative distribution function plot(ecdf(mydata)) and with hist I can plot a histogram of my data hist(mydata) How I can plot the histogram and the ecdf in the same plot? EDIT I try make something like that https://mathematica.stackexchange.com/questions/18723/how-do-i-overlay-a-histogram-with-a-plot-of-cdf 回答1: Also a bit late, here's another solution that extends @Christoph 's Solution with a second y-Axis. par(mar = c(5,5,2,5)) set.seed(15) dt <-

Plot RTT histogram using wireshark or other tool

不问归期 提交于 2020-01-01 03:20:55
问题 I have a little office network and I'm experiencing a huge internet link latency. We have a simple network topology: a computer configured as router running ubuntu server 10.10, 2 network cards (one to internet link, other to office network) and a switch connecting 20 computers. I have a huge tcpdump log collected at the router and I would like to plot a histogram with the RTT time of all TCP streams to try to find out the best solution to this latency problem. So, could somebody tell me how

Add second x-axis in ggplot2

前提是你 提交于 2020-01-01 03:09:12
问题 In the "graphics" package one can add a second x-axis (indicating the percentiles of the distribution) to a histogram as follows: x <- rnorm(1000) hist(x, main="", xlab="Bias") perc <- quantile(x, seq(from=.00, to=1, by=.1)) axis(1,at=perc,labels=c("0","10%","20%","30%","40%","50%","60%","70%","80%","90%","100%"),cex=0.5, pos= -90) That looks awkward, of course. So how can I modify the following ggplot2 code to add a second x-axis, shwing the percentiles, while the first x-axis should

How can I get a histogram/summary stats if I have a table with counts? [duplicate]

霸气de小男生 提交于 2019-12-31 07:36:44
问题 This question already has answers here : How can I create a histogram from aggregated data in R? (4 answers) R Newbie - Histograms/Frequency of values incorporating a quantity Column [duplicate] (1 answer) Closed 5 years ago . I'm used to having a vector of observations like c(1,1,1,3,4) on which I can see summary statistics and plot histograms etc...but now I find myself with, the same data, but in a compressed format like this: value, numObs 1, 3 3, 1 4, 1 How can I easily "unwrap" this

Compare multiple histograms in file OpenCV

有些话、适合烂在心里 提交于 2019-12-31 06:57:30
问题 I have a dataset of images, where I create the histogram of every image and then I want to store (write) them into a file, so that for every new image I use as input, I compare the histogram of this image with the ones I already have in the file and find if they are identical. The code so far is this: import numpy as np import cv2 import os.path import glob import matplotlib.pyplot as plt import pickle index = {} #output dic out = { 1: {}, 2: {}, 3: {}, } for t in [1]: #load_files files =