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

gnuplot rowstacked histogram: how to put sum above bars


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?


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)


WPF: 2 different label sizes in particular order alignment

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: ...

C++ Pass a string into a pipe to 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...

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

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('thriller.jpg')) self.photoLabel.configure(image = img5) self.photoLabel.image =...

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

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...

add label overlay Google Maps

I'm success add infowindow <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Google Map Lazy Load</title> <script src="//"></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 plot times when they're given as UNIX timestamps with added milliseconds?

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...

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

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...

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

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...

gnuplot rowstacked histogram: how to put sum above bars

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...

Change axis displayed value in D3

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...

GNUPLOT: Joining different series of points with vectors

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...

SAS proc sql - how to read in log of variable but retain the variable's 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...

JavaFX PiChart, my hover values blink

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)...

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

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...

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

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...

Label linked to a text box value

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...

Set with lines in 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?

Gnuplot: Conditional splot of a function

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...

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

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...

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

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...

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

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?...

Creating a hexplot

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...

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

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,...

How to highlight regions of plot with gnuplot

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...

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

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',...

Offset gnuplot grid lines so that they match xtics

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...

Gnuplot plotting all datafiles automatically

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...

graphviz cluster's label multiple lines

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:...

Labelling nodes in 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...

Changing the text of a 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...

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

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...

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

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...

Java label irregularity (possible bug?)

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) {...

How to select subplot in gnuplot multiplot mode

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?

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 bar chart from this CSV input

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 <<...

gnuplot highlighting points when with lines

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...

gnuplot - splot inline data and point 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...

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

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...

How to make gnuplot to NOT plot multiple lines?

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...

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

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...

Can I set a default Y range in 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...

Trouble dynamically changing state of checkbox with AJAX

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')...

Gnuplot, normalize over x axis

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...

Set label on group multiplot in 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 add axis labels to a simple.scatterplot (UsingR)

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...

How to plot columns numbered greater than 1000 in 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...

Facing difficulty to pass label value into listview

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...

Cannot get Text from label jQuery, possible ID error?

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()) ; } }); I believe...