User ticks and zero line

I'm making graph with a zero line on the Y axis, and I would like to use User Ticks on the Y axis as well.  However, when I select User Ticks, the zero line disappears.  I could always make a zero trace, but the zero line is far more convenient.  Is there a reason that you can't have a zero line with User Ticks?  I'm seeing this in Igor 8.04 in both Win10 and MacOS Mojave.

 

MWE:

FUNCTION Zero_Line()

    Make/O/D/N=100 W_Data=sin(p/5)
   
    //Graph with auto ticks
    Display/N=Auto_Ticks/K=1 W_Data as "Auto_Ticks"
    ModifyGraph zero(left)=1        //Zero line appears
   
    //Graph with user ticks, including zero in the labels
    Make/O/D/N=9 Tick_Values_with_zero={-1, -0.5, -0.25, -0.1, 0, 0.1, 0.25, 0.5, 1}
    Make/O/T/N=9 Tick_Labels_with_zero=num2str(Tick_Values_with_zero)
   
    Display/N=User_Ticks_with_Zero/K=1 W_Data as "User_Ticks_with_Zero"
    ModifyGraph userticks(left)={Tick_Values_with_zero,Tick_Labels_with_zero}
    ModifyGraph zero(left)=1        //No zero line
   
    //Graph with user ticks, but without zero in the labels
    Make/O/D/N=8 Tick_Values_without_zero={-1, -0.5, -0.25, -0.1, 0.1, 0.25, 0.5, 1}
    Make/O/T/N=8 Tick_Labels_without_zero=num2str(Tick_Values_without_zero)
   
    Display/N=User_Ticks_without_Zero/K=1 W_Data as "User_Ticks_without_Zero"
    ModifyGraph userticks(left)={Tick_Values_without_zero,Tick_Labels_without_zero}
    ModifyGraph zero(left)=1        //No zero line
   
END

 

Oh, my.

The user ticks code repurposes the category axis code to draw the arbitrary ticks and labels. Since it makes no sense to put a zero line on a category axis, the zero line simply doesn't get drawn. I'm looking into the possibility of adding that into the category axis code.

In the meantime, you can use the drawing tools to fake it:

    SetDrawLayer UserFront
    SetDrawEnv xcoord= prel,ycoord= left
    DrawLine 0,0,1,0

If you're using the Igor 9 beta, you may wish to change "prel" to "axrel", which deals with axis stand-off better than prel.

I have fixed this failure in Igor 9 beta. I hesitate to make that change in Igor 8, as it could introduce a bug. It has been this way for as long as the user ticks from waves feature has existed!

Hi John

Thanks for working on this.  "Oh, my" usually isn't a phrase that one wants to hear, so it's nice to hear that this has been fixed.  Not adding this to Igor 8 makes sense, and using the drawing tools has worked fine.  

"Oh my" is my usual response when a customer discovers something wrong or missing and it has been that way for a decade or more! We appreciate getting told about them, of course.