How can I access the Axle property in an axis ruler?

조회 수: 8 (최근 30일)
Aaron Guidarelli
Aaron Guidarelli 2017년 8월 9일
답변: Yair Altman 2017년 9월 29일
I want to remove the lines on the X and Y axis that border the chart area. After googling around for a while I came across this blog post explaining about the Axle property in the X, Y, and ZAxis properties of the axis. MATLAB has been updated since that post and the NumericRuler is now stored in the XAxis, YAxis, and ZAxis property. The Axle property doesn't show up in the list of all properties but it is possible to access when using the command window using
ax = axes;
ax.XAxis.Axle.Visible = 'off';
If run line by line in the command window, this works and removes the XAxis line. But if it is run in a script, MATLAB does not find the Axle property and believes I am trying to set something that doesn't exist. Can someone explain this behavior? I am running version 2016b.
Thanks
  댓글 수: 2
José-Luis
José-Luis 2017년 8월 9일
편집: José-Luis 2017년 8월 9일
Well, the Axle property described in the post you link to is an undocumented property, and as such the Mathworks can change it without warning. There is no documentation for it.
For instance, the Axle property does not exist in my version (2016a).
Yair Altman
Yair Altman 2017년 9월 29일
Jose-Luis - the property does exist if you only took the time to dig a bit and follow my blog carefully. The fact that you cannot see a property when you use the get function or property inspector does not necessarily mean that it doesn't exist, the property might just be hidden (in which case you can access it if you know its name).

댓글을 달려면 로그인하십시오.

채택된 답변

José-Luis
José-Luis 2017년 8월 9일
If you want to make the x-axis disappear:
ax.XAxis.Color = 'None';
  댓글 수: 6
Adam
Adam 2017년 8월 9일
Be careful with multiple axes on top of each other though. You can get some unexpected behaviour from things like zooming and callbacks, adding a colorbar etc. I used a 2nd axes as a solution to some similar problem and had to mess around for a while fixing these kind of problems so that my true axes behaved correctly. It may be easier for you though - I did actually have something plotted on my 2nd axes.
José-Luis
José-Luis 2017년 8월 9일
편집: José-Luis 2017년 8월 9일
The devil is, as is his wont, in the details.
As with most kludges, your mileage may vary.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Yair Altman
Yair Altman 2017년 9월 29일
The Axle properties only become accessible once the graphics are fully rendered. This is why it works in your command window (where you have short delays between commands) but not in your script (where everything runs at much higher speed).
To solve the problem, simply add a call to
drawnow; pause(0.1);
(you can play with the pause value for optimal results).

Jan
Jan 2017년 8월 9일
편집: Jan 2017년 8월 9일
What about:
ax.Box = 'off'
This
ax.XAxis.Color = 'none';
would influence the ax.XColor also and the tick labels might vanish also..
  댓글 수: 1
Aaron Guidarelli
Aaron Guidarelli 2017년 8월 9일
Unfortunately the box property only removes the top and right borders not the bottom and left ones.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by