Getting nice integer ticks

Hi igorians,

I have a couple of graphs where I want to have integer x-axis ticks.

The code is pretty straight forward

    Make/o data = p
   
    Display/k=1 data
    string graph = S_name

    ModifyGraph/w=$graph manTick(bottom)={0,1,0,0},manMinor(bottom)={0,50}


but this looks kind of ugly as the x ticks overlap. The x-axis is a running acquistion index.

So basically I would like to say something "Use a tick increment of 1 if the ticks don't overlap, a factor of 5/10 if not". I could not find a way to do that with IP7. The graphs are freely resizable by the user so I need a flexible solutions for different sizes.

Any suggestions?
I can't think of a good solution except a laborious approach that you've probably already considered (i.e., a very detailed window hook. One that is triggered by window resizing, axis range changing, or font size changing. When triggered, it would then check the current font size for the axis and the current size of the axis. From this it would estimate the maximum number of integers that can currently fit and set the manTick parameter to try to meet but not exceed that). Tick label text overlap is one of the few areas where I think there is some room for improvement with Igor's automatic graphing.
aoa wrote:
One that is triggered by window resizing, axis range changing, or font size changing.


Are you thinking about window event 8/"modified" here?
I wasn't thinking in much detail, but it does look like event 8 catches axis range and font size changes, while event 6 catches window size changes. One might also compare against a userdata to see if whether the specific values of interest actually changed.
Maybe this doesn't handle the full range you want, but you can set the suggested number of ticks as high as 100. Then Igor will adjust the visible tick labels to fit.

One little problem- if you make such a graph very narrow you get some peculiar choices of major ticks...

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
WideGraph.png (30.14 KB) NarrowGraph.png (12.72 KB)
thomas_braun,

Maybe you can use a user computed tick labels and values, like so:

modifygraph mantick=0, userticks(bottom)={w_labels, w_values}


w_labels and w_values can get updated on a graph resize event or axis range change.

best,
_sk