Gnuplot Bar Graph With Error Bars
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or gnuplot boxerrorbars posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss gnuplot error bars style Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only
Gnuplot Bar Chart
takes a minute: Sign up Gnuplot barchart histogram with errorbars up vote 7 down vote favorite 2 I want to the results of my benchmarks. I compare two virtual machines with each other and have data of the following form: BENCHMARK
Gnuplot Boxes
VM1_TIME VM1_ERROR VM2_TIME VM2_ERROR I want to generate a barchart diagram from this data which should look like this: Could somebody provide the code how to do this? I know this kind of request is unbeloved, but I really need this and googled for something like 2 hours, without a satisfactoring result. Thanks in advance, Sven gnuplot bar-chart share|improve this question asked Aug 19 '12 at 2:25 Sven Hager 1,14721022 1 What about sharing your data, or offering some mock gnuplot set style histogram data, to play with? –vaettchen Aug 19 '12 at 2:55 I do not have concrete data yet because I need to know in what format Gnuplot wants it. However, it is clear that I have 5 columns of data: 1) Benchmark name 2) Time it took VM 1 to compute it (in milliseconds) 3) Time it took VM 2 to compute it (in milliseconds) 4) Error of VM 1 times (in milliseconds) 5) Error of VM 2 times (in milliseconds) –Sven Hager Aug 19 '12 at 13:02 If you want help, you need to provide data in a way that can easily copied & pasted - dput( mydata ) is always good. It will also be a good idea to provide the code you have tried that got you close but did not work. This is not only a matter of courtesy but also helps to avoid misunderstandings in terms of data structure, objectives etc. –vaettchen Aug 19 '12 at 13:46 1 possible duplicate of adding error bar to histogram in gnuplot –mgilson Aug 19 '12 at 23:23 1 Of possible interest: Adding error bars on a bar graph in gnuplot. –chl Aug 21 '12 at 8:13 add a comment| 2 Answers 2 active oldest votes up vote 6 down vote accepted I had the same problem once. Here is the code from the gpl file which should lead to the desired result: set
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about
Gnuplot Xtic
Stack Overflow the company Business Learn more about hiring developers or posting ads with gnuplot error bars and lines us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a gnuplot using community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Gnuplot Bar chart with error bars up vote 1 down vote favorite I have the http://stackoverflow.com/questions/12023736/gnuplot-barchart-histogram-with-errorbars following data Name Value of the bar Confidence interval A 0.62 [0.59 0.63] B 0.64 [0.54 0.72] C 0.51 [0.46 0.67] D 0.33 [0.25 0.36] I tried to plot it as a bar chart with A,B,C and D labeling each bar and with and error bar. By using plot "my.dat" using 1; with boxes I only get a bar chart. Can someone help me? gnuplot bar-chart axis-labels share|improve this question http://stackoverflow.com/questions/24871941/gnuplot-bar-chart-with-error-bars asked Jul 21 '14 at 18:17 Samuel 475 add a comment| 1 Answer 1 active oldest votes up vote 1 down vote If you also want errorbars, you must add a second plot with the yerrorbars plotting style. The brackets aren't very handy in the data file, so I remove them with a sed command: set style fill solid set boxwidth 0.8 set yrange [0:*] unset key plot "< sed 's/[][]//g' my.dat" using 0:2:xtic(1) with boxes, \ '' using 0:2:3:4 with yerrorbars lc rgb 'black' pt 1 lw 2 share|improve this answer answered Jul 21 '14 at 19:21 Christoph 29.5k72847 Thank you! That's what I wanted. –Samuel Jul 22 '14 at 8:28 Is there any possibility to change the color of the bars? So that each bar has a different color or pattern (filled with dots or lines) –Samuel Jul 22 '14 at 16:05 Yes, you can use e.g. lc variable to color the bars based on some value (possible the row number): plot "< sed 's/[][]//g' my.dat" using 0:2:0:xtic(1) lc variable with boxes. –Christoph Jul 22 '14 at 18:25 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign
by the various errorbar styles. In the default situation, gnuplot expects to see three, four, or six numbers on each line http://gnuplot.sourceforge.net/docs_4.2/node140.html of the data file -- either (x, y, ydelta), (x, y, ylow, yhigh), (x, y, xdelta), (x, y, xlow, xhigh), (x, y, xdelta, ydelta), or (x, y, xlow, xhigh, ylow, yhigh). The x coordinate must be specified. The order of the numbers must be exactly as given above, though the using qualifier can manipulate the order and error bars provide values for missing columns. For example, plot 'file' with errorbars plot 'file' using 1:2:(sqrt($1)) with xerrorbars plot 'file' using 1:2:($1-$3):($1+$3):4:5 with xyerrorbars The last example is for a file containing an unsupported combination of relative x and absolute y errors. The using entry generates absolute x min and max from the relative error. The y error bar gnuplot error bars is a vertical line plotted from (x, ylow) to (x, yhigh). If ydelta is specified instead of ylow and yhigh, ylow = y - ydelta and yhigh = y + ydelta are derived. If there are only two numbers on the record, yhigh and ylow are both set to y. The x error bar is a horizontal line computed in the same fashion. To get lines plotted between the data points, plot the data file twice, once with errorbars and once with lines (but remember to use the notitle option on one to avoid two entries in the key). Alternately, use the errorlines command (see errorlines (p.)). The error bars have crossbars at each end unless set bars is used (see set bars (p.) for details). If autoscaling is on, the ranges will be adjusted to include the error bars. See also http://gnuplot.sourceforge.net/demo/mgr.htmlerrorbar demos. See plot using (p.), plot with (p.), and set style (p.) for more information. Next: Errorlines Up: Plot Previous: Zticlabels Contents Index Ethan Merritt 2007-03-03