Warning creating vertical line using xline

40 views (last 30 days)
I ran into a warning when using the xline function. I went all the way back to running the simple code in the MATLAB help on xline and still get the same warning. Here's the code from help:
x = linspace(0,6,100);
y = exp(x);
plot(x,y)
xline(4.5,'-',{'Acceptable','Limit'});
The following warning appears:
Warning: Error updating ConstantLine.
Too many input arguments.
Warning: Error creating or updating CompositeMarker
Error in value of property Anchor
Array is null
Warning: An error occurred while drawing the scene: Cookie 0 does not refer to a node in the scene tree
The plot appears as the one in the MATLAB help, but the label on the vertical line is not drawn:
If I try to select the vertical line with the "Edit Plot" arrow, the warning is repeated in the command window and there is no visible indication I have selected the line. However, if I have the property inspector open, it shows I have the vertical line selected. I can also see the appropriate label in the property inspector for the vertical line. If I delete the label text in the property inspector, the selection indicators appear at each end of the line and the warning is no longer repeated in the command window. If I type a new label in the property inspector, the label appears at the plot origin and a warning again appears in the command window.
Warning: Error updating ConstantLine.
Too many input arguments.
Warning: Error creating or updating CompositeMarker
Error in value of property Anchor
Array is null
Obviously, the help example should not be causing this issue. Maybe my settings or preferences are causing the problem? I've closed and reopened MATLAB a few times thinking something could have gotten in a weird state, but that did not change anything. Any ideas about what might be happening?
Edit: I tried the same xline command without the label and it works without the warning. If I add a single line label, for example,
xline(4.5,'-','Limit');
it produces the same warning and behavior as the multi-line label in the example.
When trying to debug the error, I get into the internal MATLAB .m file xyzline.m. The warning appears after executing Line 85:
hcl.Parent = parentAxes;
Edit 2: The warning that is thrown does not come from xyzline.m. It is thrown by defaulterrorcallback.m. The id is "MATLAB:handle_graphics:Canvas:RenderingException" and the msg is "An error occurred while drawing the scene: Cookie 0 does not refer to a node in the scene tree." I wonder if there is something wrong with my graphics rendering settings.
  11 Comments
Matt
Matt on 7 Dec 2019
Do you think that might be the cause? I would have to go through IT to have them do the update. Does anything else jump out at you?
Walter Roberson
Walter Roberson on 7 Dec 2019
Nothing jumps out, but I have seen people have problems with the Intel HD drivers that are more than 2 years old. It's worth trying.

Sign in to comment.

Accepted Answer

Matt
Matt on 24 Jan 2020
Follow Up: This is still an issue. I had someone remote into my machine who ran MATLAB with admin rights and they were able to run the example code successfully. They then gave me admin rights and I ran MATLAB with my account and the example code ran successfully. After removing my admin rights, I ran MATLAB again and the example code produced the same original problem. So it is not related to the graphics card, but these data points provide more questions than answers. Any new thoughts?
  2 Comments
Walter Roberson
Walter Roberson on 24 Jan 2020
I tend to think of possible path problems, that you might be accidentally using a routine from a third-party toolbox. I would suggest experimenting with
restoredefaultpath
Matt
Matt on 25 Jan 2020
That worked. I stepped into every line of code from calling xline until the warnings occurred and MATLAB never opened a third-party m-file, but there must have been something there. We have a large library of common code, so I guess I'm going to have to start adding folders in one at a time or something along those lines to figure out where the conflict exists.
Thanks for all your help.

Sign in to comment.

More Answers (2)

Image Analyst
Image Analyst on 7 Dec 2019
It worked for me. As an alternative, you might try the older line() and then use text() to place the text annotation.

Matt
Matt on 7 Dec 2019
Being such a simple example, I imagine it will work for everyone. I did a number of google searches and did not see anyone discussing a similar issue.

Categories

Find more on Graphics Performance in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!