I'm trying to do a histogram in gnuplot, but I don't want my bins to have fixed width. I need the width of a bin to respect the actual width of the interval.
Also, I'm not really sure what to put in the data file or how to organize it.
Can someone help me with doing this?
I need the graph to look like
this
Related
Sorry for my English,
I would like to make a histogram in gnuplot, where bins are not separated one from another by vertical lines, something like it is shown in the following figure:
I usually use "plot [...] with boxes" command to make a histogram, but it leads to a histogram with such vertical lines, which make the histogram unclear for bigger number of bins in the plot.
My data consists of two values for every value of x.
My comment again as answer, according to the StackOverflow "rule": no answers in comments...
You are probably looking for:
plot ... with steps
Check help steps. You may also want to check this answer about steps.
Ok, this is a bit of a funky idea, but is it possible to generate a dataset of points that, when plotted, display a desired text? I remember seeing this somewhere, but have no idea how to do it.
I'm trying to plot using labels with varying font size. For example:
plot "some_data_file" using 1:2:(20-$3) using labels font sprintf("Helvetica,%d",variable)
Or something to that effect. The label's font size should be 20 minus the value in the third column. This line doesn't work, but I think it displays what I'm trying to do. Any ideas?
Look at cities.dem demo on gnuplot.info for a way to do this.
I'll steal the solution there, modified for you:
plot "some_data_file" using 2:3:(sprintf("{/Helvetica=%d %s}",\
20-$4, stringcolumn(4))) with labels
I have a set of data that I'm plotting as a scatter graph which has both positive and negative values on both axis. When I plot this in Flot, the axis are draw at the bottom and the left by default. Is there a way to make it draw the axis through the center of the graph? #X=0 and Y=0?
In other words, instead of this:
I want something like this:
That isn't possible in the default flot. I'm sure it could be hacked in if you wanted to dig into the source, but flot by itself only supports left/right for the y-axis, and top/bottom for the x-axis.
In case anybody else comes across the same need, I created a plugin for Flot and put it here:
https://github.com/burlandm/Flot-Origin-Axis
It does what I need, but I won't make any promises that it'll fit your particular scenario. If I have time, I might try and update it to cover more scenarios.
Gnuplot, a great package ... I'm in love with it. But we can have our tiffs as well, as any couple :-)
This time, I wanted to simply plot the roots of an equation: say a quadratic to keep things simple. However, I only want two nice round dots appearing on the x-axis representing the point where the quadratic crosses the x-axis or y=0 axis. In other words the roots (when they are real that is).
I don't want to do this with datafile ... I want gnuplot to calculate the roots and plot them.
First off, my attempts: single points aren't really what gnuplot would have you plot, it likes a good wide range of values. Preferably filling up the whole width of your canvas.
It's possible to locate a rectangle at a certain coordinate on your plot, but I wanted a round point. Currently I'm chasing up how to do a tiny filled polygon at that point. I have tried the "samples" option bu it doesn't seem useful.
Also though about defining a dirac-delta function so that only one point would be highlighted (though two would be needed).
ANy suggestions welcome, thanks.
there is a way, but it takes just a little bit of fiddling
narrowness=1
set yrange [0:10]
set xrange [-10:10]
poly(x)=(x**2+3*x-2)
roots(x) =floor(narrowness*poly(x))?1/0:0
plot roots(x) w points pt 7
depending on the function and the range you will need to set the width differently. if you see too many circles increase the narrowness, if you see too few (aka. none) decrease the narrowness
Cheers!
/B2S
oh, and PS. to increase accuracy set samples to some higher value
And Alternatively if you happen to already know the roots, say r1(2,0) and r2(-1,0) then you can plot them using
plot '-' with points pt 7
2 0
-1 0
e
Not sure if this really helps, but if you can define a custom function to calculate the roots, gnuplot will display it.