label,gnuplot,histogram , gnuplot rowstacked histogram: how to put sum above bars


gnuplot rowstacked histogram: how to put sum above bars

Question:

Tag: label,gnuplot,histogram

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,8";

puts the labels in the correct place, but the calculated sum is wrong. That is, in ($0-1):($2+$3+0.2):($2+$3), the second $2 appears to evaluate to zero.

What's going wrong here and how do I fix it?


Answer:

You must give an explicit string as label:

 plot newhistogram 'foo', 'file.dat' u 2:xtic(1) t col, '' u 3 t col, \
'' u ($0-1):($2+$3):(sprintf('%.1f', $2+$3)) notitle w labels offset 0,1 font "Arial,8"

As other improvement, I would use the offset option which allows you to give an displacement in character units, which doesn't depend on the yrange.

(Side note: if a value from a column is used, then one can skip the explicit formatting of the label, like using 1:2:2 with labels, but in general one should use sprintf to format the label)


Related:


Set label on group multiplot in gnuplot


linux,graph,plot,gnuplot
Im plotting one picture with 4 different graphs using gnuplot. Labels for their x and y axes have the same meaning. If Im plotting it like this: set multiplot layout 2,2 rowsfirst set xlabel "x" set ylabel "y" set title offset -3,-3 set xrange [20:70] set yrange [0:15000] set title...

How to plot columns numbered greater than 1000 in gnuplot


plot,gnuplot
I have a file with 1600 columns. plot "file" using 1:999 title columnhead(999) plots column 999, but plot "file" using 1:1000 title columnhead(1000) produces column 100 instead of 1000, producing the same result as plot "file" using 1:100 title columnhead(100) Apparently large column numbers are wrapped. Is there a work-around...

Can I plot times when they're given as UNIX timestamps with added milliseconds?


datetime,gnuplot
I'm using gnuplot 4.4 on CentOS 6.6. I've found many examples online showing that the following (note the use of %.3S) will enable timestamps like "12:42:51.047" to be parsed and used as X axis values: set xdata time set format x "%H:%M:%.3S" set timefmt "%H:%M:%S" However, my input is not...

WPF: 2 different label sizes in particular order alignment


wpf,alignment,label
Please take a look at this picture: I try to create same label with 2 sizes: <Grid> <Label Content="11" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50" /> <Label Content="%" HorizontalAlignment="Right" FontSize="20" VerticalAlignment="Top"/> </Grid> But currently this is not like the picture: ...

Gnuplot: Conditional splot of a function


conditional,gnuplot
I want to splot the function exp(-(x²+y²)) alone and under the constraint of x+y-1=0. The result should be the surface alone as well as a line with a maximum at x=y=0.5. Or in other words, it's the intersection of the function with a (110)-plane. What I came up so far...

Plotting the inverse of the numbers in columns in gnuplot with for loop


for-loop,gnuplot
I want to plot the inverse of the numbers in a number of columns against the first column: plot for [i=1:30] 'file' using 1:(1/i) w lp which results in all the y values to be zero. It works when I remove the for loop and just pick a column to...

Labelling nodes in networkx


python,graph,beautifulsoup,label,networkx
I'm trying to extract one set of values from a URL. This set has a unique list of numbers. The number of elements in this list should be equal to the number of nodes. So the label that these nodes get should come from the list extracted. How can this...

Label linked to a text box value


excel,vba,textbox,label
Good morning, I am editing an User Form on VBA Excel and I would like to show an alert if the user insert a certain value in a text box. I wrote this code: If txtbox.Value < 0 Then lbl_Alert.Visible= True Else lbl_alert.Visible=False End IF The code works properly but...

Why does the content of my label not change with this jQuery?


jquery,html,label
I want to change the content of a label via jQuery. I've got this code: HTML <input type="checkbox" id="ckbxEmp" >Employee? <label id="lblSSNOrITIN">Bla</label> jQuery $(document).on("change", '[id$=ckbxEmp]', function () { var ckd = this.checked; var $lbl = $('[id$=lblSSNOrITIN]'); $lbl.prop("content", ckd ? "SSN" : "ITIN"); }); ...which can be fiddled with here Label...

How do I change the text size in a label widget, python tkinter [duplicate]


python,tkinter,label
This question already has an answer here: How to change a widget's font style without knowing the widget's font family/size? 5 answers In python 3.4 using Tkinter, how do I change the text size in a label widget? So far I have tried label_one = Label(root, text = 'Hello',...

Is it possible to “print” gnuplot's output directly to STDOUT?


c++,gnuplot
I am using a third-parter utility named gnuplot-iostream to invoke gnuplot from C++ in the back-end of a web application. That web application is executed under CGI, so anything that goes to STDOUT is the result to browser. In this case, the web request will be for the image itself,...

gnuplot - splot inline data and point labels


gnuplot,labels
Hi Im using this data to get a 3d/2d like histogram. I want to label each histogram column with a 'dx cx' label preferable on top of the column. With my example the graph is drawing correctly, but there are no labels. if I'm using only the using 1:2:3:4 with...

add label overlay Google Maps


google-maps,google-maps-api-3,label
I'm success add infowindow <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Google Map Lazy Load</title> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script type="text/javascript" src="http://localhost/label/label.js"></script> <style> #map-canvas{ width:100%; height:500px; position: "absolute"; top: 0px; left: 0px; overflow: "hidden"; } </style> </head> <body> <div...

Can I set a default Y range in gnuplot?


gnuplot
My graphs will be generated based on runtime data, such as user-provided time ranges. I can't know ahead of time whether data within the requested xrange will actually exist. In the case that it's not, I'd like to show a blank plot (with X=time range as requested, but arbitrary Y...

Change axis displayed value in D3


d3.js,label,axis
I would like to change the value of the y-axis in my graph, such as, instead of displaying [0,18], it displays [-18,0]. My initial code for the axis is: var y = d3.scale.linear().range([height, 0]); var yAxis = d3.svg.axis() .scale(y) .orient("left"); and I tried to modify it like this: var yAxisInv...

Can you play sound in windows while doing another task simultaneously?


python-2.7,tkinter,label
Is there a way to while playing winsound.PlaySound("some sound", FLAGS) also change a photolabel? I've been trying and no matter where I put the play sound it always play the sound before changing my photo label. My code: def thriller(self): winsound.PlaySound("thriller.wav", winsound.SND_NODEFAULT) img5 = ImageTk.PhotoImage(Image.open('thriller.jpg')) self.photoLabel.configure(image = img5) self.photoLabel.image =...

How to draw a histogram with broken x-axis and string labels?


gnuplot,histogram
I am trying to draw a histogram with broken x-axis. I learnt the basic solution from this post. However, the x-axis of my histogram is based on strings, not number. It's like this: set terminal pdf set output "test-bar.pdf" set boxwidth 1.0 absolute set style fill solid 1 border 0...

Does anyone know how to get rid of the “small bar” in a gnuplot graph?


gnuplot
Below is my gnuplot code. set term pdf enhanced set output "plot/test.pdf" set datafile separator "," set xtics norangelimit set ytics nomirror set termoption dashed set xlabel "times" set yrange [0:100] set xtics nomirror set grid ytics set key right bottom plot 'plot/test.csv' using 2:xtic((int($0)%20)==0?sprintf("%d", $0*10):"") title "Comparing with the...

Cannot get Text from label jQuery, possible ID error?


javascript,jquery,html,label
If i use another ID to get some data, it's no problem, but when i use "lbl_BlendCalc_1.1_I" as an ID i cannot get the text. (Changed this ID is not possible). <input id="yes1" type="checkbox"> <label style="width: 100px;" id="lbl_BlendCalc_1.1_I">test</label> $('input').change(function() { if (this.checked) { alert($("#lbl_BlendCalc_1.1_I").text()) ; } }); http://jsfiddle.net/wycvy/338/ I believe...

Creating a hexplot


r,matlab,matplotlib,gnuplot,matlab-figure
I am trying to create a figure like the one depicted in the third column of the following image: Link for the image in case of backup. Basically I have x and y positions of 200 particles and I have the MSD data for these 200 positions. I'd like MSD...

Gnuplot, normalize over x axis


gnuplot
I've got two datasets referring to the same process executed in two different ways. The execution A is slower than the execution B with respect to real time, but the two graphs represent the same phenomena.. I can plot the two together as follows: plot 'A' using 1:2, 'B' using...

gnuplot - get errors on fit parameters, get fit output values as variables, print variable to screen


variables,gnuplot,curve-fitting,data-fitting,function-fitting
Initial Question (Partially Answered) I am using gnuplot's fitting routines to fit a function to some data, and extract a "characteristic decay time constant". (I call this parameter d in my fitting function.) I have used the script code set fit quiet to prevent reams of text being printed to...

graphviz cluster's label multiple lines


python,label,graphviz,multiline
I'm using python+graphviz in order to create networking topologies out of the information contained in Racktables. I've succeded pretty well so far but I'm willing now to add multiple lines labels to a cluster (not a node). For example, I have the following code with python: for router in routers:...

Plotting multiple columns with a for loop in gnuplot, key doesn't work


for-loop,gnuplot
I have file with many columns that I'd like to plot as follows: plot for [i=1:30] 'test' using 1:i w lp This gives the plot I want, but when I do set key, then the key I see has all lines labeled as 1:i: How can I make this output...

plotting points in 3d surface using x,y,z coordinates


3d,gnuplot
I need to plot some points in 3d surface based on x,y,z coordiantes values in a file named as test.dat test.dat file contains At-No X Y Z 6 3.532210 -2.171743 0.921140 7 1.164869 -1.418981 0.782133 1 2.454732 2.332989 -0.907213 6 -3.246376 -1.047325 -0.602590 6 -2.620684 0.053348 -0.013310 6 -4.569969 -1.249720...

How to make gnuplot to NOT plot multiple lines?


plot,scripting,gnuplot
I am plotting some data and I am getting multiple lines streaking across the plot. There should be one line, so I imagine that gnuplot is trying to fit the data and is joining points or something in a strange way. How can I get gnuplot to plot one like...

In JQGrid, How can I dynamically get the column header label when validating a filtertoolbar field?


javascript,jqgrid,header,label
I have a jqGrid with the filtertoolbar option enabled. For a column or columns in the grid, I want to validate the column in some fashion, e.g., if an input field exceeds a certain length, display an alert. When I display an alert, I want to display the column header...

Gnuplot bar chart from this CSV input


bash,gnuplot
I have csv file data.dat for example with these values: #W=1 0;sqlite;11500 1;hsql;14550 2;h2;17550 #W=2 0;sqlite;11000 1;hsql;13800 2;h2;16500 #W=3 0;sqlite;11000 1;hsql;13800 2;h2;16500 #W=4 0;sqlite;11000 1;hsql;13800 2;h2;16500 I need to plot bar charts into pdf. each data for each graph starts with title #W1,#W2.... i have tried this script: cat <<...

JavaFX PiChart, my hover values blink


javafx,popup,label
Context : Hi ! I'm trying to create a little popup which display the value of slice when mouse hover, on my PieChart (with JavaFX). I successed on my LineChart, AreaChart etc.. Thanks this post : JavaFX LineChart Hover Values (thank you so much Jewelsea for your help). Problem (1/2)...

Update label's text when pressing a button in Kivy for Python


python,python-2.7,button,label,kivy
Here is my code: I want to make a game where the main_label changes text when you press a button but I've looked everywhere for a week and still don't understand how to do it. I looked on Kivy's website but I don't understand. As you can see I'm new...

C++ Gnuplot pipe input from C++ defined variables


c++,pipe,gnuplot
I am using C++ to pipe commands to gnuplot using the following code: FILE *gnuplotPipe = popen("gnuplot -persist", "w"); // Open a pipe to gnuplot if (gnuplotPipe) { // If gnuplot is found fprintf(gnuplotPipe, "reset\n"); //gnuplot commands fprintf(gnuplotPipe, "n='500'\n"); fprintf(gnuplotPipe, "max='1500'\n"); fprintf(gnuplotPipe, "min='-1500\n"); fprintf(gnuplotPipe, "width=(max-min)/n\n"); fprintf(gnuplotPipe, "hist(x,width)=width*floor(x/width)+width/2.0\n"); fprintf(gnuplotPipe, "set term...

Set with lines in gnuplot


gnuplot
I can connect the dots of a data file by including with lines in the plot command. Is there a way to set this fixed (I was hoping for set with lines) so I don't have to explicitly include it in every call of plot?

SAS proc sql - how to read in log of variable but retain the variable's label


sql,sas,label
I am reading in variables from a few different datasets using proc sql, which I am trying to improve on. What I'd like to do is read in a variable from a dataset using proc sql, but take the log of the variable as it's read in, but keep the...

Why isn't this program repainting a certain part of an applet even when repaint() is called


java,swing,applet,label,repaint
This is a simple rock, paper, scissors appelet. there are 3 variables keeping track of wins, losses, and ties. Then there is a label that is meant to display them. When I used the debugger the repaint method is being called so I don't understand why this portion of the...

Java label irregularity (possible bug?)


java,label,java-8,standards
If we look at the Java standard §14.7, we see that statements may have label prefixes, e.g.: LabeledStatement:      Identifier : Statement In theory, a label should be able to label any succeeding statement. So, for example, the following compiles accordingly: public class Test { public static void main(String[] args) {...

GNUPLOT: Joining different series of points with vectors


function,vector,gnuplot,points
I have a file with data in 2 columns X and Y. There are some blocks and they are separated by a blank line. I want to join the points (given by their coordenates x and y in the file) in each block using vectors. I'm trying to use these...

Gnuplot plotting all datafiles automatically


bash,gnuplot
I have multiple *.data files each has same format and can be plotted with this simple script: cat << __EOF | gnuplot -persist set terminal pdf set output 'out.pdf' set datafile separator ";" set boxwidth 0.5 set style fill solid plot "xxx.dat" using 1:3:xtic(2) with boxes __EOF How can i...

gnuplot rowstacked histogram: how to put sum above bars


label,gnuplot,histogram
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...

How to add axis labels to a simple.scatterplot (UsingR)


r,graph,label
The package UsingR has some great out of the box plotting tools. However, using the simple.scatterplot function I can't figure out how to add axis labels. library(UsingR) simple.scatterplot(iris$Sepal.Length, iris$Sepal.Width, xlab='hello axis') Error in plot.default(x, y, xlim = xrange, ylim = yrange, xlab = "x", : formal argument "xlab" matched by...

Changing the text of a C++ CLI label


c++,c++-cli,label
I am trying to change the text of a label in a C++ CLI program. I need to take a value the the user entered in a textbox, insert that into a short string, then change a label to that string. I have no problem constructing the string, but I...

Offset gnuplot grid lines so that they match xtics


gnuplot
How do I move the vertical grid lines so that they match the horizontal labels/xtics? In the following image, the vertical grid lines don't line up with the xtics: I tried setting the xtics offset before setting the grid, but that doesn't seem to work.Here's my current script: #!/usr/bin/gnuplot -persist...

Facing difficulty to pass label value into listview


c#,asp.net,listview,label,formview
What i am looking for is to get the value of " Label10 " which is into viewmsgView and then bind the FormView1 depending on the label value, Note: viewmsgView & FormView1 are located into same view and in same page. But i am getting an error message as below...

How to select subplot in gnuplot multiplot mode


gnuplot,subplot
is there any way to select a subplot in gnuplot's multiplot mode as in subplot(n,m,x) in Matlab where x is the one I want to plot at? I am plotting three points using linespoints on a graph in red color at first, then I want to plot a single point...

gnuplot - How can I count the number of entries in a csv file column?


csv,plot,gnuplot,function-fitting
I have a gnuplot code which includes a function fitting routine. This routine is slow when a large number of data points must be fitted. The number of data points in my input file is variable depending on the parameters of some simulations I am running. I wish to fit...

gnuplot highlighting points when with lines


plot,gnuplot,highlight
I have 4 points I would like to plot using gnuplot, but with lines. The problem is, I can't find how to highlight these 4 points on the drawn line. I would like for the plot to be a line through the points, but that these points are also clearly...

C++ Pass a string into a pipe to gnuplot


c++,string,pipe,gnuplot
I'm having a small problem passing a string to gnuplot from c++ I can pass integers easily enough, but when I try a string (user defined as "title" earlier in the code): fprintf(gnuplotPipe, "set title %s\n", title); I get the error: error: cannot pass objects of non-trivially-copyable type ‘std::string {aka...

about drawing sinus function in gnuplot when it is pressed a keyboard


gnuplot
Is it possible to draw sinus function on the interval: [-2*pi, 2*pi] in the following way: when I press right arrow on the keyboard to produce sinus function on the interval: [-2*pi, -pi] when I press again to plot sinus function on the interval [-pi, 0] .... Is it possible?...

Trouble dynamically changing state of checkbox with AJAX


ajax,checkbox,label
I am trying to have to check boxes through ajax, but it is not working properly. I am not able to change state of the first checkbox, only the second one is working fine. Could anyone spot the error here? $.ajax({ type:"POST", url:"../scripts/domainlist.php?dept="+deptid+"&pro="+proid, contentType:"application/json; charset:utf-8", dataType:"json", success: function(data){ $('#domainlist').empty(); $('#domainlist')...

How to highlight regions of plot with gnuplot


gnuplot,highlight,radar-chart
I'd appreciate if somebody can help with this question. I am working with a radar (or spiderweb) plot with gnuplot 5.0.0: The scale and range in all axes is the same. The numbers at and beyond 1 have a special meaning and I would like to highlight that. I am...