histogram

Log scale (x axis) histogram

戏子无情 提交于 2019-12-13 15:26:57
问题 what I need is a histogram with X axis displayed on a log scale. However, I still want every bar in a histogram to be of the same width. Whatever, I came up with (or upon) display bars with higher values as narrower ones (they are of the same width on ordinary scale and not on log scale). Here is what I am doing now: edges = 10.^(c_min:0.1:c_max); h = histc(data, edges); bar(edges, h); set(gca, 'Xscale', 'log'); 回答1: Since your bars should be evenly spaced, you can plot them with x-values 1,2

Controlling scatterhist bar colors

僤鯓⒐⒋嵵緔 提交于 2019-12-13 14:09:06
问题 I was trying to make the bars in my scatterhist plot be of the same color as the markers: x = randn(1,20); y = randn(1,20); myColour = [1 0 0]; % red scatterhist(x, y, 'Color', myColour); mygca = get(gca,'children'); set(mygca,'markerfacecolor', myColour); However, the bars are of a slightly different color, namely a reddish hue, [249 96 96]: The Scatterhist documentation seems to suggest bar colors just follow marker color, which in this case does not happen. How can I control color of the

Put value at centre of bins for histogram

本小妞迷上赌 提交于 2019-12-13 13:46:46
问题 I have the following code to plot a histogram. The values in time_new are the hours when something occurred. time_new=[9, 23, 19, 9, 1, 2, 19, 5, 4, 20, 23, 10, 20, 5, 21, 17, 4, 13, 8, 13, 6, 19, 9, 14, 9, 10, 23, 19, 23, 20, 19, 6, 5, 24, 20, 19, 15, 14, 19, 14, 15, 21] hour_list = time_new print hour_list numbers=[x for x in xrange(0,24)] labels=map(lambda x: str(x), numbers) plt.xticks(numbers, labels) plt.xlim(0,24) pdb.set_trace() plt.hist(hour_list,bins=24) plt.show() This produces a

Histogram, error: Error in plot.new() : figure margins too large [duplicate]

点点圈 提交于 2019-12-13 13:45:19
问题 This question already has answers here : Error in plot.new() : figure margins too large in R (13 answers) Closed 4 years ago . I have to plot 141 histograms in R. I am working with windows 8. then I write: par(mfcol=c(12,12), oma=c(1,1,0,0)) for(m in 1:141 ){ x <- precData[[m]] hist(x[x != 0],30, xlab=NA, ylab=NA, main=statData$Name[m]) } But always I get this error: Error in plot.new() : figure margins too large How can I solve it?? Is there any command for adjusting the size of each

Overlapping Histogram in For Loop with heapq.nlargest - Python

倖福魔咒の 提交于 2019-12-13 10:25:42
问题 At the moment I've created a for loop which cycles through my arrays and dumps out the result on a PDF however I'm having trouble combining this with heapq.nlargest. I want to overlap my histograms with the top 10% scores for each array with pandas. Currently, the code is x = list(df1.columns.values) fig = plt.figure(num=None, figsize=(30, 200), dpi=80, facecolor='w', edgecolor='w') for i in range(6):#(len(df1.ix[i])): val= x[i] y = df1.iloc[:,i] yy = heapq.nlargest(len(df1.iloc[:,i])//10,

How to plot histogram in R?

ε祈祈猫儿з 提交于 2019-12-13 10:02:32
问题 I am using R and I would like to plot a histogram where x-axis is the number of vehicles and y-axis is the time interval. Something like: 回答1: I guess you need a barplot: x <- data.frame(n_vehicles = c(10, 20, 30, 40), time_interval = c(2, 5, 4, 9)) barplot(height = x$time_interval, names.arg = x$n_vehicles) Or alternatively: plot(x = x$n_vehicles, y = x$time_interval, type = "h") The "h" stands for "histogram". 来源: https://stackoverflow.com/questions/38480183/how-to-plot-histogram-in-r

matlab, each bar in histogram correspond to which letter [duplicate]

 ̄綄美尐妖づ 提交于 2019-12-13 10:01:47
问题 This question already has answers here : matlab plot histogram indicating sum of each character inside a file (2 answers) Closed 4 years ago . I have 400 files, each one contains about 500000 character, and those 500000 characters consists only from about 20 letters. I want to make a histogram indicating the most 10 letters used (x-axis) and number of times each letter is used (y-axis). I wrote this code which has missing thing which is I want to know each bar is corresponding to which letter

HISTOGRAM (Array = Stars Output)

左心房为你撑大大i 提交于 2019-12-13 09:47:39
问题 HISTOGRAM: I have problem in my code.. The Intended Output must be something Like this: Output: 0 8 ******** 1 6 ****** 2 3 *** 3 7 ******* But mine shows: 0 8 ******************************* 1 6 ******************************* 2 3 ******************************* 3 7 ******************************* I've searched and compare it to my code but nothing really helps me though.. Can you kindly take a look at my code and give some suggestions, and comments on how could I code the intended output

Aligning bins to xticks in plt.hist

心不动则不痛 提交于 2019-12-13 07:12:57
问题 I'm making a histogram of precipitation rate means from climate models and the histogram function worked, but the x-axis irks me ever so slightly. I want there to be a tick directly in between each bin like for 2.55. However, some of the ticks are off, mainly on the left side. Is there any way I can align them properly? x = np.arange(0.006,0.0345,0.0015) print (x) #Make historical (1979-2015) histogram plt.figure(figsize=(11,7)) plt.hist(histmeans, 19, color='#808080') #labels & axes #plt

Multiple lines in histogram legend

℡╲_俬逩灬. 提交于 2019-12-13 06:36:16
问题 I am trying to plot a histogram with a legend that consists of two lines. Running the following code leads to the error: Error using matlab.graphics.chart.primitive.Histogram/set Value cell array handle dimension must match handle vector length. xErr = randn(1,1000); [mu, sig] = normfit(xErr); h = histogram(xErr, 100, 'Normalization','pdf'); % The following command causes the error set(h_xErr, {'DisplayName'}, {['Standard deviation $\sigma_{x} = $ ', num2str(sigX)]; ['Mean $\mu_x = $ ',