bugGNU Octave - Bugs: bug #35985, subplot resets the plot when...

 
 

bug #35985: subplot resets the plot when changing axes position

Submitter:  Fabio <efferre79>
Submitted:  Sat 24 Mar 2012 12:28:07 PM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Documentation
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 3.6.1 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 04 Sep 2013 10:26:15 PM UTC, comment #8: 

I ran the script under Matlab R2009b and it does
clear the axis at the last command.

Octave clears it at the line:
subplot (211) % up to here no problem

So, it appears to me that this and #39874
are related.  I think that Octave should not
clear the plot at the line:
subplot (211) % up to here no problem

It is less clear whether following Matlab
behavior at the line:
subplot(211) % here the plot is cleared!

is appropriate.

Michael Godfrey <godfrey>
Group Member
Wed 04 Sep 2013 10:05:55 PM UTC, comment #7: 

bug #39874 is separate from this bug #35985.

The '874 bug is about switching back and forth between identical subplots.  When doing so the axis should not be cleared.

the '985 bug is about switching to a subplot where the axis has been shifted.  In this case, a previous reporter has said that Matlab clears the axis.

Here is code that should work on Matlab for verification.  It doesn't use a command line function which is Octave-only syntax.


subplot (211)
plot (1, 2,'*r')
subplot (211) % up to here no problem
p = get (gca, 'Position');
p(1) = p(1) + 0.1;
set(gca, 'Position', p);
subplot(211) % here the plot is cleared!



Rik <rik5>
Group administrator
Wed 04 Sep 2013 08:29:01 PM UTC, comment #6: 

I just noticed that bug #39874 is really the
report that addresses the data clearing issue.

I do not really understand this bug report. And,
I could not get the code to work under Matlab.

Michael Godfrey <godfrey>
Group Member
Wed 04 Sep 2013 07:20:28 PM UTC, comment #5: 

I just tried a number of subplot() commands in
Matlab.  Nothing that I tried, other then clf,
cleared either of the subplots.

This seems to me appropriate behavior.

Even without Matlab compatibility, I think
that it is not appropriate to delete a subplot
unless the user does something explicit to
request that.  subplot(2,1,2), for example,
should just make subplot(2,1,2) the current
plot.

If you have a specific sequence that you expect
Matlab to delete a subplot I can try it.

Michael Godfrey <godfrey>
Group Member
Wed 04 Sep 2013 05:08:48 PM UTC, comment #4: 

Michael, It doesn't clear the subplot even though the axes have shifted substantially?

Rik <rik5>
Group administrator
Wed 04 Sep 2013 04:21:56 PM UTC, comment #3: 

I tried Matlab R2009B and found that it DOES NOT
clear the selected subplot.  This version of Matlab
only creates a new subplot if the subplot() call
refers to a plot which does not yet exist.

So, to be compatible with Matlab, and to be more
user-friendly a change is needed.

Michael Godfrey <godfrey>
Group Member
Thu 14 Jun 2012 09:38:04 PM UTC, comment #2: 

Ok, I verified also with Matlab and the behaviour is the same. I'd suggest to put a note into the documentation

Fabio <efferre79>
Sun 03 Jun 2012 02:08:04 AM UTC, comment #1: 

Note, the code is designed such that if the old axes are not in exactly the same position and the new one, it will specifically delete the old ones. I could reimplement the function such that it checks within a certain delta in every direction, but otherwise, I would say mark this per-documentation (in the source code, at least).

Anonymous
Sat 24 Mar 2012 12:28:07 PM UTC, original submission:  

Here is the code snippet to show the problem:



function apply_deltaX_position(axis, delta)
  p = get(axis, 'Position');
  p(1) = p(1) + delta;
  set(axis, 'Position', p);
end

subplot(211)
plot(1, 2,'*r','color',[1 0 0],'markersize',5)
subplot(211) % up to here no problem
apply_deltaX_position(gca, 0.1)
subplot(211) % here the plot is cleared!


Basically with the last subplot() command the plot is cleared loosing all the data and axis settings.

Fabio <efferre79>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by godfrey (Posted a comment)
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by efferre79 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-09-04 rik5 Item GroupIncorrect Result Documentation
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code