Wed 27 Jul 2016 06:03:49 PM UTC, comment #1:
I guess to use the right nomenclature, matlab refers to the syntax as:
plot (Xn, Yn, 'LineSpecn', ..., 'propertyn','valuen')
and 'property','value' apply to the entire plot, not individual lines.
|
Wed 27 Jul 2016 05:37:53 PM UTC, original submission:
This likely applies to more than just 'linewidth', but the following script works in Octave but errors out on Matlab 2016a:
in Octave 4.03:
Figure 1 - all lines thin
Figure 2 - all lines width = 3
Figure 3 - only line 3 width = 3
Figure 4 - each line a different width
in Matlab 2016b:
Figure 1 - all lines thin
Figure 2 - all lines width = 3
Figure 3 - all lines width = 3
Figure 4 - usage error:
It seems that Matlab plot command only allows "x,y,s" triplets (s being color/line/tickmark options like 'r-o'), and other property pairs must occur at the end of the command. If you specify a color the error message points a little better to this problem:
It sees 'linewidth' when it can tell there are other data objects coming, meaning it requires it to be the start of another xy pair or xys triplet. whereas Octave plots it without problem, as it seems to only apply property pairs to the previous data item. Hence the linewidth applies to all lines in Fig 2, but only the last line in Fig 3, and each one can be made different as in Fig 4.
So, the primary issue here is that Octave fails to produce matlab compatible plot output as in figure 3. secondary problem is that matlab errors on octave compatible code as in figure 4. Since the figure 4 code is required to get Octave to produce Matlab compatible output, this is a bit of a trouble. At the moment I have cumbersome if(exist(octave))-type codeblocks to handle this.
According to matlab news posts the desired method to set different linewidths is using the individual line object handles after creating the plot.
i.e., set( h, { 'LineWidth' } , {2 2 2 1}' ), where h is a 1x4 vector of handles...
|