bugGNU Octave - Bugs: bug #48647, Matlab incompatible plot output -...

 
 

bug #48647: Matlab incompatible plot output - linewidth on multiple curves handled differently

Submitted by:  Nicholas Jankowski <nrjank>
Submitted on:  Wed 27 Jul 2016 05:37:53 PM UTC  
 
Category: PlottingSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: NoneAssigned to: None
Originator Name: Nicholas JankowskiOpen/Closed: Open
Release: 4.0.3Operating System: Microsoft Windows

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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.

Nicholas Jankowski <nrjank>
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...

Nicholas Jankowski <nrjank>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by nrjank (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    No Changes Have Been Made to This Item

    Back to the top


    Powered by Savane 3.1-cleanup1