Is there an easy way to draw an object over the entire range of a graph axis with standoff enabled?
I am trying to draw a rectangle over a portion of a graph. Essentially I want to have different background colors over different ranges of the X-axis in order to delineate different data sources in a graph.
So in SetDrawEnv I set xcoord = bottom and use x values for left/right in DrawRect.
I would like to cover the full height of the plot area, so I use ycoord = prel and 0,1 for top, bottom.
Alas, with standoff enabled on the bottom axis, this only covers the real range of the plot, leaving the portion defined by the standoff clear. I can empirically approximate the desired behavior by extending the rectangle to slightly above 1.00, but it doesn't handle rescaling (e.g. for Layouts) very gracefully.
Is there a deterministic way of knowing the correct coordinate value to cover the full plot range with standoff enabled? Even if the graph is programmatically rescaled into a Layout?
-Andreas
For me, with Igor 8 I see your desired behaviour. I use User Back layer, draw with xcoord = bottom and ycoord = prel and 0,1, just as you describe. The rectangle fills to the axis regardless of the standoff setting.
November 3, 2020 at 12:08 am - Permalink
Hi Tony.
I am on Igor 8.04 and I am definitely getting different results based on the standoff setting. See attached examples.
I normally use ProgBack, but I got the same result with UserBack.
The /E and /N flags for the vertical axis also don't seem to make a difference.
Do you see something different when you open the attached sample experiment?
-Andreas
November 4, 2020 at 02:32 pm - Permalink
The problem only happens with markers on the plot.
The bottom axis is shifting below the normal plot boundary (y=1, plot relative) to accommodate the markers.
Curiously, if I set the left axis range so that the data are inset, the same thing happens. That seems strange. I haven't looked at the manual to see if it's expected. Maybe contact support (help-contact support). I would expect that plot coordinates should always coincide with the graph background, but they don't if you plot with markers and a standoff.
A work-around might be to plot using a new bottom axis, and make the new bottom axis cross left at some negative value. But then you would have to create the standoff manually by adjusting the left axis range.
November 5, 2020 at 05:03 am - Permalink
@tony The amount of standoff is intended to accommodate the width of a trace. So a lines-between-points trace with a very wide line would have noticeable standoff, too. I have tried to make the standoff account for the width of box and violin plots, also.
@topchem As far as I know, the only solution presently is to turn off standoff, and set the appropriate axis range to inset the data. Turn on the minimum and maximum manual range settings. You can try the "Expand 5%" button to get a small inset.
November 5, 2020 at 09:40 am - Permalink
In reply to @tony The amount of standoff… by johnweeks
My first ever use of "Nice + inset". I have to admit that option completely eluded my thinking.
It's not as visually appealing as standoff, but I'll take it in this case.
@johnweeks, Is there any way to make prel coordinates standoff-aware in the future? I would argue that including the standoff in the range 0,1 is in fact the correct behavior. But for the sake of backwards compatibility I would opt for a different character. Taking a cue from image plot autoscaling perhaps we could use an asterisk (*) to indicate the main or mirror axis standoff locations when used in place of left/top/right/bottom in the drawing environment.
-Andreas
November 5, 2020 at 03:29 pm - Permalink
One of our engineers is looking into what it would take to add something akin to "axrel" coordinates. Not ideal, but we can't change the behavior of prel at this point, about 25 years after it was invented!
No promises that anything will come of his investigation. And it's late in the cycle for Igor 9.
When I try it, it always seems like "Nice + Inset" makes too much space, but if it works, great.
November 5, 2020 at 04:55 pm - Permalink
In reply to One of our engineers is… by johnweeks
AxRel is working, and will be in Igor 9. AxRel is also 0-1, but the rectangle is the plot area as expanded by any axis standoff.
November 5, 2020 at 08:42 pm - Permalink
In reply to AxRel is working, and will… by JimProuty
Thanks @JimProuty. I look forward to the first beta build. ;-)
Like John said, "inset" just leaves too much white space.
November 5, 2020 at 08:57 pm - Permalink
Igor 9 is in beta testing. Here is some info released previously:
We have released beta 2. Jim's new axrel coordinate system missed that beta, so once you install the beta you will need to get the latest nightly build of the beta.
November 6, 2020 at 10:10 am - Permalink
Is it already in last night's build? Or do I wait until tomorrow?
-Andreas
November 6, 2020 at 02:15 pm - Permalink
In reply to Is it already in last night… by topchem
Tomorrow.
November 6, 2020 at 02:17 pm - Permalink
Thanks. I'll give it a whirl.
November 6, 2020 at 02:29 pm - Permalink
In reply to Thanks. I'll give it a whirl. by topchem
Well, so far axrel is working as expected. This will probably be my new default.
-Andreas
November 10, 2020 at 09:54 pm - Permalink