How to adapt the space between the grid lines to the space between the ticks?

1 次查看(过去 30 天)
Good evening everyone
As I wanted the grid lines of my plot to have a different color from the axis, I put a second axis under the first. Now I doubled the ticks on the y axis but the grid lines aren't doubleing too. Has anyone an idea how to fix this?
Thank you (Btw I am still using R2007b)

回答(1 个)

dpb
dpb 2018-5-17
You have to address the proper axes object to change its properties...to make working with multiple axes easier, be absolutely sure to save the handles of each when you create them so have to "talk to" the desired one.
Post your code so far so we can use it for pedagogical purposes to get from where you got (sounds like good start) to where you're headed...(and actually, the above hint may be all the help you really need, we'll see :) ).
  4 个评论
beginner94
beginner94 2018-5-18
Thank you very much! I didn't realise that ''gca'' always addresses to the last called axes in the script, therefor the confusion! This also explains why I had to use ''linspace'' twice. It works now and the best: I even know why!:D
I wasn't able to use the newish ruler object and the ''datetime'' function though because of my (very) ancient matlab version (R2007b) :/
(I would accept your answer but it came as a comment :S)
dpb
dpb 2018-5-18
>> help gca
gca Get handle to current axis.
H = gca returns the handle to the current axis in the current
figure. The current axis is the axis that graphics commands
like PLOT, TITLE, SURF, etc. draw to if issued.
...
gca is a function so its return value is variable depending on what has happened since -- this is particularly significant when either in a GUI or interactive session and the user (or you) switches context.
Ah, ok, older releases do prevent using later features...

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Graphics Object Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by