unusual axis formatting - nonstandard labeling

Hello All,

I want to make an axis with the numbers directly adjacent to the left or right of the tic marks on the X axis. I can't seem to find any setting like this. I have attached a screenshot example of what the axis looks like in another program.

Any help is appreciated!

Thanks,

Josh

picture of axis

I found no way to laterally offset tick labels and align them as shown, so there is no simple setting to do this. You could fake it of course by using the text tool to label each tick manually or with a small script. I have attached an example of this. Of course, using the text tool is way less flexible than normal axis label, but if you write a small script for this you could easily update the tick labels to adapt for changing tick positions. Otherwise, I guess you will have to wait until WM adds support for lateral tick label offsets.

tick label test.pxp

Here is a *very* bare-bones Igor function that will do something like that:

Function OffsetTickLabels(String gname, Wave tickvals, Wave/T ticklabels)
    Variable nticks = numpnts(tickvals)
    Variable i
   
    if (strlen(gname) == 0)
        gname = WinName(0,1)
    endif
   
    SetDrawLayer progfront

    // Erase any previous axis drawn by this function
    DrawAction/W=$gname getgroup=SpecialTickGroup, delete
   
    // start a named group so that it can be erased
    SetDrawEnv/W=$gname gstart, gname=SpecialTickGroup

    // "axrel" coordinates are 0-1 coordinates that span the rectangle
    // inside the axes
    SetDrawEnv/W=$gname xcoord=axrel, ycoord=axrel
    // The axis line
    DrawLine/W=$gname 0,1,1,1
    for (i = 0; i < nticks; i++)
        Variable value = tickvals[i]

        // Draw a tick line: Using xcoord=bottom so that we can specify
        // the tick positions in data values
        // The hard-coded values 1.01 and 1.1 should be adjustable input options!
        SetDrawEnv/W=$gname xcoord=bottom, ycoord=axrel
        DrawLine/W=$gname value, 1.01, value, 1.1

        // Draw the tick labels, rotated by 90. That should be an option.
        // The hard-coded 0.8 and 1.1 should be options
        SetDrawEnv/W=$gname textrot = 90, xcoord=bottom, ycoord=axrel
        DrawText/W=$gname 0.8*value, 1.1, tickLabels[i]
    endfor
    SetDrawEnv/W=$gname gstop
end

It takes a graph name string which can be "" to use the top graph window, a numeric wave full of axis values where you want the ticks, and a text wave full of corresponding labels.

The drawing is done using the ProgFront draw layer. It makes a named group drawing object so that it can erase any previous drawing done by a previous invocation of the function.

Ways in which this is deficient:

It should take an input that sets the offset between the tick and tick label

It should take an input that sets the length of the tick lines

It should take an input that specifies which axis to use (note that the X coordinates here are set to "bottom" to use the bottom axis)