Thu 07 Jul 2016 05:10:43 AM UTC, comment #14:
Matlab apparently changed their defaults for grid lines when they moved to Handle Graphics 2 and started using the alpha channel on grid lines. I updated Octave to follow Matlab and use '-' as the default for gridlinestyle and ':' for minorgridlinestyle. See http://hg.savannah.gnu.org/hgweb/octave/rev/05ad23810150.
I reversed the interpretation of the alpha property as you suggested in this cset (http://hg.savannah.gnu.org/hgweb/octave/rev/6f10765eca35).
The gridlines now seem to be okay, a little dim, but okay.
|
Wed 06 Jul 2016 11:11:14 PM UTC, comment #13:
I saw that Matlab called this "transparency" but didn't see the description of which extreme is what. I just assumed a positive correlation between the number and "transparency". But I suppose the 0.15 default makes more sense when viewed as being nearer to transparent for a grid line.
It's a simple change of
and works as expected.
However, there is a problem here, and this may have been what confused me. With these default property settings:
the grid lines (major or minor) aren't visible. If the gridlinestyle is '-', i.e., solid, then the alpha/color combination works OK. Should that be the default linestyle for "grid on"? Dots (':') is OK when the lines are nearer to opaque.
Another aspect of this is the difference between gnuplot (alpha implemented) and qt/fltk (no alpha implemented). Compare the following:
Even though qt/fltk can't do true alpha blending, perhaps it should simply multiply the grid color channels by 1-alpha to get something close to the same affect as alpha blending.
(file #37742)
|
Wed 06 Jul 2016 10:14:20 PM UTC, comment #12:
@Dan: I pushed the change for polar plots here (http://hg.savannah.gnu.org/hgweb/octave/rev/eb751495ba43).
Could you take a look at the alpha mode? According to Matlab
I think it is currently backwards where 1 is completely transparent and 0 is completely opaque.
|
Wed 06 Jul 2016 08:14:16 PM UTC, comment #11:
OK, thanks. Attached is a small oversight I noticed when attempting "demo polar", i.e., axis_idx doesn't exist if there was no axis drawn.
(file #37739)
|
Wed 06 Jul 2016 05:21:34 PM UTC, comment #10:
I cleaned up the patch a bit. I used "endif" rather than "end" and "strcmp" instead of "strcmpi". Also, I found another case when the grid lines are not visible: gridcolor = "none". I added a check for that and pushed everything here (http://hg.savannah.gnu.org/hgweb/octave/rev/1a8e2a0251c3).
Seems everything is okay now, closing report.
|
Wed 06 Jul 2016 08:30:56 AM UTC, comment #9:
So many variations... An updated patch is attached, fairly straightforward.
To test the alpha blending, try something like:
(The red/green combo makes me think of graph paper from way too far back to mention.) As for alpha blending, experiment with different values of alpha and it become apparent it is working. The grid lines could also be achieved by setting the color (while alpha is 0), but I think the difference with alpha blending is that the point where the grids and data curve intersect are a blend rather than one color or the other.
(file #37728)
|
Tue 05 Jul 2016 09:12:16 PM UTC, comment #8:
@Dan: This works fine for minor grids. One remaining difference is that I can set a linestyle of "none" for major/minor grids with the OpenGL toolkits and this effectively hides that particular grid, even though it is "on".
Is there a simple way to check for "none" and not draw the grid?
Transparency isn't implemented at all in the OpenGL toolkits (the interface to OpenGL hasn't been written; OpenGL certainly supports it). If it's easy to add then it makes sense to correct that incompatibility with Matlab as well for the gnuplot toolkit.
The "layer" property determines whether the axes object is on top or below the other graphic objects.
|
Tue 05 Jul 2016 07:53:47 PM UTC, comment #7:
OK, additional patch attached for minor grid lines. Note that the command should be
i.e., axis not figure.
Let me know what you think of the minor grid lines. They look fine, but perhaps not as nice as for 'qt' toolkit. Those could be tweaked.
It looks like right now properties 'gridalphamode' and 'gridalpha' don't do anything in any of the toolkits. I think that could be used in gnuplot just by changing "rgb" option to "rgba" option. Is it supposed to be alpha blending when the grid lies at the front of the view?
(file #37725)
|
Tue 05 Jul 2016 06:59:05 PM UTC, comment #6:
@Dan: Works for me. I pushed your cset here (http://hg.savannah.gnu.org/hgweb/octave/rev/79e7a6fc524d).
I noticed that 'gridlinestyle' and 'gridcolor' override the corresponding minorgridXXX properties. I'm re-titling the bug to reflect that, but this is pretty minor stuff.
Steps to reproduce:
At this point, gridlinestyle has been changed to '-' and minorgridlinestyle is still at ':'. You can see what it is supposed to look like by doing
Also try,
But this has no effect.
|
Tue 05 Jul 2016 06:08:02 PM UTC, comment #5:
Give the attached patch a try. gnuplot doesn't have dashtype for "set grid", but I managed to make it work by using a "linetype" definition. (I'll send a note to gnuplot about that oversight.) After your test example, try something like:
set(gca, 'gridlinestyle', ':', 'gridcolor', [0.1 0.5 0.1])
Also in the patch I add an extra conditional to get rid of some redundant lines of gnuplot code that set the characteristics for a non-existent point style. There is actually more of this sort of redundant code if one sets points without lines. The whole do_linestyle_command() could be reworked. I began down that path but found the "found_style" and so many conditions to be confusing.
(file #37723)
|
Tue 05 Jul 2016 04:41:06 AM UTC, comment #4:
For gnuplot 4 or lower. no unified treatments dash or dotted lines for all terminals exist. I suspect that it is reason why the functionality is not supported for gnuplot graphics toolkit.
On the gnuplot ver. 5, unified treatments dash or dotted lines are implemented and thus the functionality mentioned here can be implemented.
But this is only possible when gnuplot version is 5.
|
Tue 05 Jul 2016 04:06:54 AM UTC, comment #3:
This doesn't work in 3.8.2 either. I suspect that the functionality was never programmed into the Octave/gnuplot interface.
|
Tue 05 Jul 2016 03:57:54 AM UTC, comment #2:
I have built octave-4.1.0+ (revision 22035:634fbedbfb5b) on Ubuntu 14.04 amd and also confirmed the same results.
The value "Release" can be "dev".
|
Tue 05 Jul 2016 12:01:06 AM UTC, comment #1:
I have confirmed issue on native windows (4.0.3), cygwin (4.0.1) and linux (4.0.3). (Windows 10 and Ubuntu).
Therefore "Operating System" should be "any".
|
Mon 04 Jul 2016 09:09:42 PM UTC, original submission:
+verbaitim+
% gnuplot_gridline_problem.m
% octave> set(gca, "gridlinestyle")
% [ - | -- | -. | {:} | none ]
%
% When "xgrid" or "ygrid" is on
% all options are available to "qt" but
% every option produces ":" gridlines with "gnuplot"
graphics_toolkit("gnuplot");
% graphics_toolkit('qt'); % uncomment for correct results
x = 0 : 0.1 : 3.5;
y = sin(x);
close all;
figure;
plot(x, y);
axis([0, 3.5, 0, 1.5], "equal");
set(gca, "xgrid", "on", "ygrid", "on", ...
"gridlinestyle", "-", ...
"linewidth", 1, ...
"xtick", [0 : 0.5 : 3.5], ...
"ytick", [0 : 0.5 : 1.5] ...
);
printf("gridlinestyle: %s\n", get(gca, "gridlinestyle"));
-verbatim-
|