How To Change Color Of Axis Tick Marks

19 vues (au cours des 30 derniers jours)
Jesse Abruzzo
Jesse Abruzzo le 23 Mar 2016
Hello all i am currently trying to change the color of the tick marks on my axis from black to yellow. I tried changing directly through the 'GUIDE' interface and that didnt work. So i tried using code which was this:
set(handles.axes4,'XColor','y'); set(handles.axes4,'YColor','y');
And it still didnt work so im kinda at a loss here. Any help would be apprecaited thanks!
  2 commentaires
Walter Roberson
Walter Roberson le 23 Mar 2016
Which MATLAB version are you using? The methods changed in R2014b.
Jesse Abruzzo
Jesse Abruzzo le 23 Mar 2016
Modifié(e) : Jesse Abruzzo le 23 Mar 2016
I am using matlab R2014a

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 23 Mar 2016
In R2014a and before, there is no mechanism provided that would allow you to easily set the tick mark colors to something different than the box color. In order to have them a different color you will need to draw the tick marks in yourself, or find code that can do it for you. Possibly the File Exchange contribution plt() might have this feature available.
As of R2014b this changed, but R2014b itself the mechanism was not finalized. R2015a finalized the method, but even that is not as flexible as one might prefer; see http://www.mathworks.com/help/matlab/ref/numericruler-properties.html for R2015a onward.
  8 commentaires
Jesse Abruzzo
Jesse Abruzzo le 1 Avr 2016
I figured out the problem but im still stuck. When i write the line of code: axes(handles.axes4); It sets the color of the tickmarks back to default and i cant change it back afterwards. Help?
Walter Roberson
Walter Roberson le 1 Avr 2016
I would not expect that but it could be a bug.
The workaround would be not to call axes() that way. Instead, pass the axes handle as a parameter to graphics operations. Most graphics routines accept an axes as the first parameter but not all do, and the rest typically accept a 'Parent' name value pair. The ones that do not accept that either probably ignore the current axes anyhow.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Graphics Performance dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by