[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: print -dashed fails with gnuplot backend
From: |
Ben Abbott |
Subject: |
Re: print -dashed fails with gnuplot backend |
Date: |
Wed, 10 Nov 2010 20:02:37 +0800 |
On Nov 10, 2010, at 7:19 PM, Jarno Rajahalme wrote:
> I used to get the different dashed lines with gnuplot, but with the current
> tip I get an error instead (gnuplot 4.4.2, was the same with 4.4.0):
>
> octave:1> plot([10 5; 2 16; 3 7], '-')
> octave:2> legend('a', 'b')
> octave:3> print test.eps -dashed -deps
> error: set: invalid handle (= -16.0668)
> error: called from:
> error: [...]octave/scripts/plot/print.m at line 377, column 9
> octave:3>
>
> Playing with it, sometimes it works, but even then the dashes are all the
> same simple ones.
>
> Any ideas?
>
> Jarno
In order to consolidate the print function for all backends, Octave now handles
the dashed lines itself. It is possible that I did not implement the "-dashed"
option in the proper way. What I did was to *temporarily* set the linestyle
property for all line objects to "--".
If I got that wrong, we may want to enter a bug in the tracker.
Regarding the crash, I modified your example to try to isolate the problem.
plot([10 5; 2 16; 3 7], '-')
legend('a', 'b')
h_before = findall (gcf, "-property", "linestyle", "visible", "on");
try
print test.eps -dashed -deps
catch
h_after = findall (gcf, "-property", "linestyle", "visible", "on");
cmp = h_before == h_after;
printf ("handle before = %8.4f, handle after = %8.4f, %d\n", [h_before,
h_after, cmp]')
tag = get (unique (cell2mat (get (h_after(!cmp), "parent"))), "tag")
end_try_catch
With this modification, I get ...
handle before = -17.2920, handle after = -17.2920, 1
handle before = -16.4276, handle after = -16.4276, 1
handle before = -15.3394, handle after = -15.3394, 1
handle before = -14.8455, handle after = -14.8455, 1
handle before = -13.6448, handle after = -13.6448, 1
handle before = -12.0651, handle after = -12.0651, 1
handle before = -10.6675, handle after = -10.6675, 1
handle before = -9.0918, handle after = -9.0918, 1
handle before = -8.6763, handle after = -8.6763, 1
handle before = -7.1982, handle after = -7.1982, 1
handle before = -6.2106, handle after = -6.2106, 1
handle before = -5.3132, handle after = -5.3132, 1
handle before = -4.8541, handle after = -4.4170, 0
handle before = -3.4331, handle after = -3.1299, 0
handle before = -2.0219, handle after = -2.0219, 1
tag = legend
it appears the handles for the line objects of the legend axes are changing
during the print process.
I've cc'd David since he worked on that part.
A solution may be to check that the lines are not part of a legend axis before
substituting the dashed linestyle, but I'll wait on David's thoughts before
implementing that. Perhaps he'll have a better idea.
Ben
Re: print -dashed fails with gnuplot backend, Jordi GutiƩrrez Hermoso, 2010/11/10