Octave with gnuplot adds edges in a mesh - gnuplot

When doing surf in octave I get the following results, with different graphics_toolkit.
Run:
surf([1 2 ; 1 2 ],[1 1; 2 2],[6 2 ;4 6],'FaceColor','interp')
To change graphics toolkit you may need to restart octave and run:
graphics_toolkit ftlt|gnuplot
I want gnuplot (B) to display edges as in fltk (A). For some reason I dont understand, gnuplot adds a lot of edges in the middle of the plotted faces (B) which I want to remove.
Using 'EdgeColor','none' (C) I'm able to remove all edges, although I want to keep the edges between datapoints (ie, those shown in A).
An option would be to use fltk, but I prefer the presentation (coulouring and shape) and latex support gnuplot provides.
So: How to make gnuplot show only the edges between datapoints (ie. those in A)??
A) Using default fltk:
B) Using gnuplot:
C) Using gnuplot with 'EdgeColor','none'

Related

Gnuplot key: sample and title positions

Is it possible to adjust the relative vertical position of the sample in a key
and its title? Running these commands
set terminal pdfcairo
set output 'foo.pdf'
set yrange [-1.2:1.2]
plot sin(x)
produces a plot with a key that looks like this:
I'd like the sample in the key to be a bit lower relative to the title in the key (or the title in the key a bit higher relative to the sample in the key).
EDIT: There seem to be other issues with alignment, not just in the key. This is the whole graphic produced by the commands above, using the latest Gnuplot installed by homebrew on OSX 10.10.5 (Gnuplot 5.2.2, cairo 1.14.12). The same thing is evident on OSX 10.11.6. At least some of the labels on the xaxis seem to be shifted a bit to the right of the tic, and labels on the yaxis seem to be shifted down.
help set key provides you with all necessary details. In your case, probably
set key left
would already help. But there is also the option to tell gnuplot precisely where you want the key to be placed, using
# This places a key at coordinates x = 6.5 and y = 0.8 in the coordinate system:
set key at 6.5,0.8
Another way, rather than playing around with key positions, is also to adjust the range in a way that comfortable space is left for the key, in your case
plot [-10:+10][-1.1:1.2] sin(x)
might help.

"pixel dimension information" when plotting with image in gnuplot

Using gnuplot v5 patch 6 on windows 10 (wxt terminal)
I have a data file of 2D vectors arranged in six columns (x, y, v_x, v_y, v_mag, rho) that I'm trying to plot as a heatmap of v_mag against x and y. The plot generates fine, but it's always coming up with
"No dimension information for 80000 pixels total. Try 200 x 400"
But I have no idea where to specify this in the terminal.
I realise that I can use pm3d map for this, but this doesn't work without setting dgrid3d and that causes problems with plotting dots on top of the heatmap which I'm also doing. I also don't want to generate a matrix file just for the image plot since I need the vector data for analysis later.
In terms of an example, the plot will generate if I literally just write:
plot 'vectors.dat' using 1:2:5 with image, 'dots.dat' with dots
EDIT: added 'set pm3d' to example code
EDIT: example is now minimal code to produce desired plot
EDIT: example data file can be found here
Any help would be appreciated.
After updating my gnuplot to v5.2, this problem has disappeared.

Gnuplot: hide plots by default?

I'm Using Gnuplot 4.6 (I'll change to 5.0 if required) with the wxt terminal on Ubuntu 14.04. I have a single window with a single plot with multiple curves like this:
plot 'file1' u 1:2 w l, '' u 1:3 w lp, 'file2' w i, '' u 1:3 wp pt 7 etc
I can click the keys of curves to hide/show them. Can I make some of them hidden by default?
This is useful as I am comparing computation outputs and use a lot of labels and different lines/points/impulses etc for different data, and the graph gets really messy. And many times I only need some content for a few seconds at the time, so I end up hiding most plots, to show them when needed.
Any advice is welcome! Cheers /J
There had indeed been a discussion about such a feature, i.e. change the visibility of plots via some option, see http://sourceforge.net/p/gnuplot/mailman/message/31315515/. As far as I know, that wasn't implemented yet.
If it helps you, there are some hot keys which allow you to change the visibility of many plots:
show bind
gives the following hot keys
...
i `builtin-invert-plot-visibilities`
...
V `builtin-set-plots-invisible`
v `builtin-set-plots-visible`
So, you can invert the visibility of all plots (i), hide all plots (V), and show all plots (v).

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 - why plotted lines disappear after certain zoom in level?

I'm completely new to gnuplot.
I'm trying to plot a couple of trivial series of data on one plot.
Actually I mean a small number of simple segments [x1,y1] -> [x2,y2]
But I noticed an annoying behaviour: when I try to zoom my canvas with mouse into specified location, e.g. lines crossing point, my lines eventually disappear. Not all at once - they
disappear one by one at different zoom levels.
I'm not able to examine specific point from close up because of this.
Is it possible prevent my graph elements from disappearing from window?
The behaviour of the plot when one or both end points of a line are outside the displayed range is controllable with set clip.
To have the line portion drawn which is inside the plot but both endpoints being outside, you must use set clip two.
Consider the following example:
plot '-' with linespoints
0.5 0.5
9.5 9.5
e
If you now zoom in, the line disappears. If you use set clip two before, then you can zoom in and the line is drawn:
set clip two
plot '-' with linespoints
0.5 0.5
9.5 9.5
e
(tested to work with 4.6.5)

Resources