Using zero line and mirror axis when an axis does not extend all the way across a graph window

Here's the scenario: I create a graph where the bottom axis extends from, say, 0 to 50% of the graph window. Now I add a zero line to the left axis using the Modify Axis dialog. The problem is that this zero line now extends all the way across the window, not from 0 to 50%. There's a similar problem if I mirror the left axis: the mirrored axis is all the way at the right end of the window, not at the edge of the actual graph.

Does anyone know how to fix this? Thanks.
It appears to me that your small graphs could easily be made into subwindow graphs, with axes spanning the desired ranges in a small portion of the larger graph window. I suspect your zero-line problem would be solved then. See the Manual documentation on sub-window graphs.

Stephen R. Chinn
Thank you. Yes, I'm sure a subwindow will do the trick. It's been so long since I've used one that I just forgot about them.

If it's really the case that you can't fix this problem without resorting to subwindows, I hope that a "fix" for this might be included in future Igor releases.
nplumb wrote:

If it's really the case that you can't fix this problem without resorting to subwindows, I hope that a "fix" for this might be included in future Igor releases.


I'm not sure that this is a bug. The left axis and the bottom axis are different axes. How would Igor know that the zero line of the left axis should only extend as far as the bottom axis is drawn? What if you had both a bottom and a top axis, and the bottom axis was drawn from only 0-50% but the top axis was drawn from 0 to 100%.

I think this is the kind of situation that subwindows (or layouts, if you want to take the opposite approach) are recommended.
aclight wrote:
I'm not sure that this is a bug. The left axis and the bottom axis are different axes. How would Igor know that the zero line of the left axis should only extend as far as the bottom axis is drawn? What if you had both a bottom and a top axis, and the bottom axis was drawn from only 0-50% but the top axis was drawn from 0 to 100%.

I think this is the kind of situation that subwindows (or layouts, if you want to take the opposite approach) are recommended.


I see your point, I think. Suppose, for instance, that I had three bottom axes sharing one vertical axis, but I only wanted the zero line to go across the middle bottom axis. It seems like the solution would to include a listbox where you can select the axes associated with the zero line. As for mirror axis, I agree you probably can't pull it off so cleanly, and it would be better to use subwindows.

The problem with subwindows - and the reason I rarely use them - is that you can't easily make global changes. I can't access a dialog where I can globally change the font size on all axes in all subwindows. And I can't set the margins of the window as a whole. This makes small modifications much more tedious.
nplumb wrote:

I see your point, I think. Suppose, for instance, that I had three bottom axes sharing one vertical axis, but I only wanted the zero line to go across the middle bottom axis. It seems like the solution would to include a listbox where you can select the axes associated with the zero line. As for mirror axis, I agree you probably can't pull it off so cleanly, and it would be better to use subwindows.


In that case I would not use the zero line of the axis at all. Instead, I would use the drawing tools to draw a line (dashed or solid, you choose). Then I would set that line to use the left axis for the Y coordinates and set Y0 and Y1 for the line to be 0. You could also set the X axis of the line to be based on the bottom axis that is relevant or to be relative, depending on what you wanted.

Given the fact that the ModifyAxis dialog is already, um, on the complicated side of things, adding additional linkages between axes might make the whole thing explode.
aclight wrote:

I would use the drawing tools to draw a line (dashed or solid, you choose). Then I would set that line to use the left axis for the Y coordinates and set Y0 and Y1 for the line to be 0. You could also set the X axis of the line to be based on the bottom axis that is relevant or to be relative, depending on what you wanted.


Brilliant! Thanks, aclight. This totally answers my original question with regards to zero line! It will work for mirror axis as well - just hand-draw the axis and associate the x and y coordinates of the line with scale. You could even hand-draw ticks, but you will have to update them by hand if you change the number of ticks, tick length, etc.

I had completely forgotten about this feature. For the uninitiated, it is accessible via Ctrl+T > Properties button > All... . I think it's wise to first do this when zoomed in very close on your data. If you're zoomed out, draw the line, and then zoom in, the line can potentially drift a little.
aclight wrote:
Given the fact that the ModifyAxis dialog is already, um, on the complicated side of things, adding additional linkages between axes might make the whole thing explode.


Well put, Adam.

John Weeks, ModifyAxis Dialog author
WaveMetrics, Inc.
support@wavemetrics.com
The drawn 'zero' line can be constructed programatically using axis units for more precision; no manual effort is required.

SetDrawEnv xcoord= bottom,ycoord= left,save
DrawLine 0,0,127,0 // (x0,y0,x1,y1) limit variables can be derived and used instead of fixed values.

With this technique, the zero line moves and scales with the graph. There should be no drift issue.

Stephen R. Chinn
johnweeks wrote:
aclight wrote:
Given the fact that the ModifyAxis dialog is already, um, on the complicated side of things, adding additional linkages between axes might make the whole thing explode.


Well put, Adam.

John Weeks, ModifyAxis Dialog author
WaveMetrics, Inc.
support@wavemetrics.com



Well, since there is already the possibility to define a crossing point for the actual axis in the ModifyGraph menu
using for example
ModifyGraph freePos(free_left_axis)={12,bottom}
it would not too much add to the complexibility of the menu if this option was also given for the mirror axis.
So assuming for example the bottom axis to be plotted from 10 to 80, in addition to define a free left axis
to cross it at 10 it would be
very helpful to tell IGOr to have the mirror axis crossing at 80.

As plotting a line with drawline does not always help (e.g. since ticks are needed)
I currently plot the wave two time once on a left axis, once on a right axis to solve this.

The next, and perhaps last, beta of 6.1 contains the following:
You can now position a mirror axis at a fraction of the normal distance using the new ModifyGraph mirrorPos(ax)=f keyword.

However this is not in the dialog at present.

I guess I should have done the zero line at the same time but the draw tools work well if you use the correct coordinate systems. For example:
Make jack=sin(x/8)
display jack
ModifyGraph axisEnab(bottom)={0,0.5}
SetDrawEnv ycoord= left
DrawLine 0,0,0.5,0