I need to plot a function on a coordinate system that has its origin at the center of the screen (or somewhere near the center, but not necessarily in the center) and I need to draw axes so that they cross at the origin. Axes should have labels and tics as well, and arrows.
I have no idea how to do this efficiently, so far in my code I manually set offsets for my tics, and draw arrows manually using offsets as well. I also set offsets on the axes labels. All this is very fragile, and offsets change depending on the terminal settings.
Would someone please help me with a sample code or an explanation how to do this the right way?
Well, using _zeroaxis is the “right” way to go to get the tics and labels in: setting the _range gives you the symmetry to make 0,0 centre … and once you know the _range, you can draw arrows on manually.