gnuplot graphs disappear after zoom - gnuplot

I run gnuplot with the following command
plot for [i=1:2] "+" using (10*$1):($1**i) with lines
Two graphs appear. If I then zoom in both graphs suddenly disappear (at a certain zoom level). This is annoying.
Of course, I do not zoom into an empty region ;-)
Does someone know how to fix that?
PS: I use the standard output terminal under linux.

Related

Gnuplot pm3d at sb

This is my second question today, I thought about editing the other one with this info but the problems doesn't seem to be related... So, with this data file, and using this code:
set terminal qt
s=101
set size square
set palette rgb 34,35,36;
set zrange[-1.8e-5:1.8e-5]
set pm3d at sb
set autoscale fix
do for [i=0:0]{
splot 'itp.txt' u 1:2:3 every:::(i*s)::(s+i*s) notitle w pm3d
}
I get this black image. This is clearly not working properly... but if I slide my finger through my notebook's touchpad while in the qt's output interactive window, this image pops up, which is what I wanted. It seems to work everywhere, except when the graph fit the "canvas". Example 1 & example 2. I'm not even sure what sliding my fingers through the touchpad while on qt's output window does, but it seems to be fixing something. So what should I do? Thank you in advance!
*qt is the qt terminal in gnuplot
Looking at the two figures you posted, it seems that the effect has to do with a changing xrange. I copied your datafile and script, and adding:
set xrange[-200:300]
did the trick for me. Also, you may consider fixing (if at all possible) your color bar range, by adding:
set cbrange[xx:xx]
with your data, I tried:
set cbrange[0:1.8e-8]
and the result looks completely different. Hope this helps.

gnuplot converting time to scientific notation

I have this program that grabs a lot of usage details regarding your computer and plots everything on a nice graph (below). The issue I am running into is that in the bottom left corner of the gnuplot window where it would normally report where on the (x,y) axis your mouse is currently at, it is reporting my x-axis in scientific notation.
For example, instead of stating that my mouse is at (33:10,20%) it is reporting that it is as (5.10770e+08,20%) <--Random scientific notation). I have already set the timefmt and xdata, so I am confused at to what I am missing in order to properly report the data. If someone could please help it would be greatly appreciated.
I have searched on superuser and Unix/Linux, and this question seems to fit on Stackoverflow the best as gnuplot has its own scripting language. Also if you look at the gnuplot tag on the various sites, gnuplot fits more on stackoverflow and has thousands of more tags compared to 30 and 67.
I have also viewed Turn Off Scientific Notation In Gnuplot and tried to implement the answer here (Christoph is the GNUPLOT man!), but have thus far been unable to configure it to work properly (it still displays the scientific notation).
gnuplot -e persist "set title 'Resource monitor' ; set timefmt '%y/%m/%d-%H:%M:%S' ; set xdata time ; set xlabel 'TIME' ; set ylabel 'PERCENT' set yrange [0:101]" -e "plot '${cpuResFile}' using 1:2 title 'CPU' smooth Bezier, '${memResFile}' using 1:2 title 'MEM' smooth Bezier ; pause -1"
You're in the right place to ask for gnuplot help!
I've tried this on x11 and wxt, don't know other interactive terminals.
You can switch between different mouse statusbar formats by pressing 1 (2 cycle backwards)
Fore more help on interactivity, press h and you'll get a list ho keyboard shortcuts
Some information is on help mouse format
To change it programmatically with the corresponding command set mouse format (but I didn't manage to display properly date/time...)

Using gnuplot with a hidpi screen.

I am using gnuplot on a hidpi screen (276 dpi).
The plots I recover are hard to see properly, the lines too thin, the fonts and buttons too small.
Is there any way to configure gnuplot to scale up these parameters for hidpi screens automatically upon start?
gnuplot automatically loads an initialisation file on startup, that you can use to change the default linewidths etc. It accepts normal gnuplot syntax. Check help initialization to see how it's named and where to place it on your system.
Use e.g. set terminal wxt lw 2 to change the absolute default linewidth. The sizes given in a later plot command are just multiplicators for the terminal setting. The pointsize and border/tics linewidth are scaled accordingly.

Set legend text's HorizontalAlignment to left in octave

I have legend text that in matlab behaves as
set(gcf,'DefaulttextHorizontalAlignment','left');
now I am attempting to replicate this in octave, but for some reason octave seems to ignore the above command.
I am using cygwin Xwin octave and GNUPlot.
(I am not trying to move the text to the other-side of the "line" legend('left'))
Doing some tests, it turns out that I can set the property, but it isn't affecting anything.
LegendHandle = legend( phvec, legendvec, 'Location', 'NorthEastOutside' );
legtxt=findobj(LegendHandle,'type','text');
get(legtxt(1),'HorizontalAlignment') %% returns left
It seems Gnuplot supports the option to change the legend horizontal alignment, but Octave doesn't provide the access to this function in Gnuplot (although it works with FLTK). You simply can't do anything about it, except filing a feature request on the Octave tracker.
Source: http://octave.1599824.n4.nabble.com/set-horizontalalignment-for-legend-text-td2218246.html
So yes, there's currently no solution to left align the legend text using gnuplot, the only thing you can do to remove this awful blank space is, as you said, to use legend('left') to swap the text to the left of the symbols.
I can replicate your problem but only if using gnuplot. It works with other graphics toolkits.
While gnuplot was Octave's default graphics toolkit for a long time, the Octave developers have been slowly replacing it with their own alternative in order to avoid its limitations. I believe recent versions of Octave will already default to fltk but you can change it yourself:
octave-cli-3.8.1> graphics_toolkit fltk
octave-cli-3.8.1> graphics_toolkit # confirm
ans = fltk
octave-cli-3.8.1> x = 0:0.1:10;
octave-cli-3.8.1> figure;
octave-cli-3.8.1> plot (x, [sin(x); cos(x)]);
octave-cli-3.8.1> legend ("long sin", "cos", "Location", "NorthEastOutside");

gnuplot: Too many tooltips appearing at once on HTML canvas, causes browser freeze

I'm using gnuplot to create a scatter plot with potentially quite a few data points (greater than 1,000,000). I use the following command to plot the data and allow tooltips on mouse hover (the terminal is html canvas as these plots are meant to be displayed in a website):
plot "$resultsFile" using 2:(stringcolumn(8) eq "chr$chrom"?\$5:1/0):1 with labels hypertext point pt 7 ps var lc rgb "black"
The issue I'm having is: when I move my mouse over a dense cluster of datapoints, so many tooltips are displayed as the mouse moves that the browser freezes for a few seconds or even longer in an attempt to display them all. Does anyone know a way to stop this from happening? Perhaps by adding a delay before the tooltip is displayed on mouse over.

Resources