Filter löschen
Filter löschen

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

3 Ansichten (letzte 30 Tage)
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)

Antworten (1)

dpb
dpb am 17 Mai 2018
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 Kommentare
beginner94
beginner94 am 18 Mai 2018
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 am 18 Mai 2018
>> 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...

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Graphics Object Properties finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by