errorbar

How to plot a grouped bar chart with errors bar as shown in the figure?

别说谁变了你拦得住时间么 提交于 2020-01-01 05:42:05
问题 I am trying to plot a grouped bar chart like the one in the figure below. I found the errorbar() function, but so far I cannot figure it out how to make it. Here is my code. Y = [0.9322225 0.86225 0.8973; 0.8953635 0.862868 0.8099605; 0.7473585 0.675698 0.80484]; bar(Y, 'grouped') bar(Y, 'BarWidth', 0.5); set(gca,'XTickLabel',{'', 'ML', '', 'HSV', '', 'NCC'}); Credit: This figure is from the work of Sanin et al. "Shadow Detection: A Survey and Comparative Evaluation of Recent Methods." 回答1: !

Plot time series with known error (ggplot2)

烂漫一生 提交于 2019-12-25 00:15:44
问题 I'm working with American Community Survey (ACS) 1-year estimates for a specific location over several years. For example, I'm trying to plot how the proportion of men and women riding a bike to work changes over time. From the ACS, I get estimates and standard error, which I can then use to calculate the upper and lower bounds of the estimates. So the simplified data structure in wide format is like this: | Year | EstimateM | MaxM | MinM | EstimateF | MaxF | MinF | |------|-----------|------

matplotlib.pyplot.errorbar is throwing an error it shouldn't?

喜夏-厌秋 提交于 2019-12-23 03:29:17
问题 I'm trying to make an errorbar plot with my data. X is a 9 element ndarray. Y and Yerr are 9x5 ndarrays. When I call: matplotlib.pyplot.errorbar(X, Y, Yerr) I get a ValueError: "yerr must be a scalar, the same dimensions as y, or 2xN." But Y.shape == Yerr.shape is True. I'm running on 64 bit Windows 7 with Spyder 2.3.8 and Python 3.5.1. Matplotlib is up to date. I've installed Visual C++ Redistributable for Visual Studio 2015. Any ideas? Edit: Some data. X=numpy.array([1,2,3]) Y=numpy.array([

Overlay two bar plots with geom_bar()

帅比萌擦擦* 提交于 2019-12-22 14:48:11
问题 I'm trying to overlay two bar plots on top of each other, not beside. The data is from the same dataset. I want 'Block' on the x-axis and 'Start' and 'End' as overlaying bar plots. Block Start End 1 P1L 76.80 0.0 2 P1S 68.87 4.4 3 P2L 74.00 0.0 4 P2S 74.28 3.9 5 P3L 82.22 7.7 6 P3S 80.82 17.9 My script is ggplot(data=NULL,aes(x=Block))+ geom_bar(data=my_data$Start,stat="identity",position ="identity",alpha=.3,fill='lightblue',color='lightblue4')+ geom_bar(data=my_data$End,stat="identity"

How to plot a figure similar to the one produced by lassoPlot.m to specify a regularization parameter?

我的未来我决定 提交于 2019-12-20 04:25:44
问题 I am trying to apply a regularized optimization other than Lasso. How can I plot the figure similar to the one produced by lassoPlot.m included in MATLAB as shown below if all data needed can be provide? How to plot the I -shaped lines? I read the lassoPlot.m but cannot find out how it is done. 回答1: If I had to create a plot like this manually, I'd do something like this: function q53809665 DATASET = [ 0.601240818 459.5714648 6.549320679 0.38951982 407.6789162 6.915203670 0.250128593 366

Change size of a line plot, understand how the size argument works

天大地大妈咪最大 提交于 2019-12-20 04:11:39
问题 I'm making a multiple lines plot with errorbars. If I don't use the size argument, everything is fine: # sample data Response=runif(4) ResponseMin=Response-Response/5 ResponseMax=Response+Response/5 Cases=rep(c("Case1","Case2"),each=2) df=data.frame(x=1:2,Average=Response,Lower=ResponseMin,Upper=ResponseMax,Case=Cases) # let's plot library(ggplot2) ggplot(df,aes(x=x,y=Average,colour=Case)) + geom_line(aes(group=Case)) + geom_point() + geom_errorbar(aes(ymin=Lower,ymax=Upper,width=0.25)) +

Plot time series with mean and vertical error bars of interquartile range by column in R

折月煮酒 提交于 2019-12-14 04:14:56
问题 I have a matrix and want to plot vertical error bars of the interquartile range and mean by column from the matrix. How do I do this in R especially ggplot2, please? A sample matrix is given below: ##Create matrix B = matrix (c(2,4,3,1,5,7,5,3,8,3,7,3),nrow=4,ncol=3) ##Create zoo object B2<-as.zoo(B) colnames(B2)<- c("A","B","C") B2 A B C 2 5 8 4 7 3 3 5 7 1 3 3 ##The Dates for the columns: Date<-as.yearmon (seq(as.Date("2000/1/1"), by = "month", length.out = 3)) I want a time series plot but

How to do Scipy curve fitting with error bars and obtain standard errors on fitting parameters?

耗尽温柔 提交于 2019-12-12 03:26:41
问题 I am trying to fit my data points. It looks like the fitting without errors are not that optimistic, therefore now I am trying to fit the data implementing the errors at each point. My fit function is below: def fit_func(x,a,b,c): return np.log10(a*x**b + c) then my data points are below: r = [ 0.00528039,0.00721161,0.00873037,0.01108928,0.01413011,0.01790143,0.02263833, 0.02886089,0.03663713,0.04659512,0.05921978,0.07540126,0.09593949, 0.12190075,0.15501736,0.19713563,0.25041524,0.3185025,0

How to organize error bars to relevant bars in a stacked bar plot in ggplot?

北战南征 提交于 2019-12-10 22:14:28
问题 I stacked the bar plots from three different treatment together for comparison. However, I am having trouble putting the error bars in the right position. I am not sure if my codes are correct since I have a feeling that this should be an easy fix. Any help would be appreciated. dff <- structure(list(month = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L), .Label = c("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"), class = c("ordered", "factor")

specify error bars with ggplot and facet_grid

痞子三分冷 提交于 2019-12-10 19:38:13
问题 I have made a graph with facet_grid to visualize the percentage of litium in each group per treatment on each day. library(ggplot2) library(Rmisc) library(plyr) mus2 <- summarySE(mus, measurevar="litium", groupvars=c("treatment", "group", "day"), na.rm = TRUE) mus2 mus3 <- mus2 mus3$group <- factor(mus3$group) ms.chl<- ggplot(mus3, aes(x=group, y=litium, fill=treatment)) + geom_bar(stat="identity", colour="black") + facet_grid(~day) + theme_bw() ms.chl resulting with this: For that I have two