Gnuplot Bar Graph With Error Bars
Contents |
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 posting ads with us Stack Overflow gnuplot boxerrorbars Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow
Gnuplot Error Bars Style
is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Gnuplot barchart histogram with
Gnuplot Bar Chart
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 VM1_TIME VM1_ERROR VM2_TIME VM2_ERROR I want to generate a barchart diagram
Gnuplot Boxes
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 data, to play with? –vaettchen Aug 19 '12 at 2:55 I do not have concrete gnuplot set style histogram 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 boxwidth 0.9 set style fill solid 1.00 border 0 set style histogram errorbars gap 2 lw 1 set style data histograms set xtics rotate by -45 set bars 0.5 if this does not work f
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 gnuplot xtic about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges gnuplot error bars and lines Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each gnuplot using 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 following data Name Value of the bar Confidence interval A 0.62 [0.59 0.63] http://stackoverflow.com/questions/12023736/gnuplot-barchart-histogram-with-errorbars 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 asked Jul 21 '14 at 18:17 Samuel 475 add a comment| 1 Answer 1 active oldest votes up vote 1 down http://stackoverflow.com/questions/24871941/gnuplot-bar-chart-with-error-bars 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 up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're looking for? Browse other question
30.34 22.58 161.08 2011-01-15 23.83 20.33 104.00 2011-01-22 50.50 16.17 79.75 2011-01-29 67.59 21.74 99.25 2011-02-05 37.58 33.33 155.33 2011-02-12 48.17 44.33 66.00 2011-02-19 89.34 12.42 91.42 2011-02-26 113.09 35.83 123.34 2011-04-02 174.25 105.25 221.25 2011-04-09 98.09 55.92 109.00 2011-04-16 http://psy.swansea.ac.uk/staff/carter/gnuplot/gnuplot_histograms.htm 98.67 30.83 202.00 2011-04-23 87.17 58.25 127.09 2011-04-30 139.74 67.33 232.84 2011-04-30 20.0 10.0 30.0 Note that there are two entries (the last two lines) for 2011-04-30; this is intentional (to demonstrate a point about time-based x values). As described in my page on time-based histograms, gnuplot does not support date/time values (as opposed to labels) for the x axis. Hence, there is no gap where March should be, and 2011-04-30 appears error bars twice in the following plots. Try using set xdata time and you'll see what I mean; you'll get the error message "need full using spec for x time data". Similarly, set timefmt and set xdata time will have no effect. The following plot commands are common to all four of the histograms shown in this page. clear reset unset key # Make the x axis labels easier to read. set xtics rotate out gnuplot error bars # Select histogram data set style data histogram # Give the bars a plain fill pattern, and draw a solid line around them. set style fill solid border Clustered With the clustered style, one column in the data file corresponds to one bar in the plot, whilst the lines of the data file correspond to the clusters of the bars. Thus, using the following plot commands, we get three bars in each cluster, and one cluster for each row (notice the two clusters for 2011-04-30, which is what we expect). set style histogram clustered plot for [COL=2:4] 'date_mins.tsv' using COL:xticlabels(1) title columnheader Figure 1: Clustered Histogram Note the use of the for feature. This allows us to select multiple columns (2 to 4, in this case); without the for, we'd only be able to plot one column of data (using something like plot 'date_mins.tsv' using 3:xticlabels(1)), which defeats the purpose of the clustered histogram: Errorbars The next histogram type is errorbars. For this, gnuplot can accept up to three columns for y values: the main value for the height of the bar, and a minimum and maximum value for the errorbar. Thus: # We need to set lw in order for error bars to actually appear. set style histogram errorbars linewidth 1 # Make the bars semi-tra