Offset graph using the mouse

Hello,

By clicking on the graph using the right mouse button i'm supposed to be able to offset my graph.

I'm having a problem where it works only one out of fivty times where if i click a drop down menu will appear.

I'm a mac user with mountain lion and I'm using the latest version of Igor (6.2).
i deleted the program and re downloaded it but no change

Is there any way to get around that problem? Anyone having the same problem?
Quote:
By clicking on the graph using the right mouse button i'm supposed to be able to offset my graph.


I'm not sure what you mean by "offset my graph" but right-clicking is supposed to display a contextual menu.

For a list of graph shortcuts, execute:
DisplayHelpTopic "Graph Shortcuts"
Quote:
What i want to do is offsetting a trace like in this video

This requires that you click (left-click) hold for a second and then drag.

We have had reports of it not working on Windows and this has sometimes been fixed by updating the mouse driver.

I am not aware of reports of it not working on Macintosh. If you are using a non-standard (i.e., non-Apple) mouse driver, that may be the problem. Otherwise I don't have any idea of what might cause this problem.

You can also offset a trace by double-clicking it and using the Offset checkbox in the Modify Trace Appearance dialog.

I fnid it fairly annoying that I can accidentally offset a trace with this shortcut.  Even worse, I often offset a trace all the way off the graph so that it disappears when I drag the mouse.

Actually, I had to search the forum to figure out what I was even doing wrong -- it was triggering by accident when I work on my laptop with trackpad.

Is there any way to turn it off? Or could it at least print the result to history, so I know that this is what happened?  

I see the help suggests hitting CAPS lock beforehand, but if I am doing it by mistake, that won't work!

The accidental offset problem has been with us for a long time. Some years ago we increased the time delay before offsetting starts to help avoid the problem. And the existence of the caps lock kludge indicates that your difficulty with this is far from unique.

I will file an enhancement ticket to add a Misc setting to control this action. We will have to ponder deeply to make sure it doesn't do something unexpected and bad :) We tend to discourage preference settings like this- people tend to set them and forget them, and then ask us why they can't do something that they told Igor not to do years ago.

Thanks for your comments. 

It could be changed to double click and hold. Or require CTRL. Or something.

I would bet pretty heavily that almost nobody uses this feature *and* that the kind of person who uses it is the kind who will figure it out for themselves what the change was.

We will be thinking about it. Though I can't prove it, I suspect from tech support queries that your last statement is inaccurate.

Just for the record, I and most of my colleagues use this feature all the time. It would be a nightmare to align (or quickly offset) spectra without this. By the way, if the Modify Trance Appearance dialog would show the result live (just like the Modify Axis dialog), then this would somewhat reduce the need for this feature a bit in my case. I could then fiddle with the offset values while instantly seeing what is going on.

In reply to by chozo

I too use use trace dragging all the time. Usually I hold the shift key to constrain the offset to the vertical direction. This is one of a group of features that sets Igor above other software for working with spectroscopic data.

@chozo i have some code that I use for quickly setting offsets for many traces on a plot. let me know if you want to take a look.

 

Thanks Tony! In fact, for this very reason I have written a small panel which can offset traces either relative to each other or all together. :) I want to release this as a project together with the graph sizing panel (the code snippet) as a toolset for graphs. But this is still far from presentable to the world. If you have something to quickly move around a specific trace (similar to dragging) then I would be very much interested.

What I have is some functions that stack traces with vertical offsets to fill the vertical space in a graph window. I wrote this not so much for producing polished output for publication, more for making plots of raw spectra efficiently. I've never documented this properly because I don't usually share this. The thing that this does differently to other tools is to calculate offsets relative to existing offsets. So I can align traces by offsetting each trace, then add an extra set of offsets to spread the traces in a uniform way. I doubt it does what you're looking for, but maybe useful for something.

 

StackTraces120.zip (3.02 KB)

Nice, thank you Tony. I will play around with that. I'll attach the current state of my panel and graph related functions. The Graph size panel is included as well (from here: https://www.wavemetrics.com/code-snippet/small-panel-set-graphs-size-ma… ). It is not polished for public use, and especially might look too cramped for Mac, but should be useable. If you have any suggestions or comments I would really like to hear them.

Spectra Graph Panels.zip (9.66 KB)

Looks great.

If you want to incorporate some ideas from StackTraces, you could add 'shift offset per trace" and "align traces at cursor position".

Perhaps also "sort traces at cursor position" to sort by (possibly offset) y value at that position.

But already it looks very useful. Thanks for sharing!

Thank you for your comment. I will definitely have a close look at your StackTraces code. I will ask again if I want to incorporate something in my toolset. I will brush up the code in the next few weeks.

Just my two cents- the Wave Arithmetic panel will apply offsets to align the A and B graph cursors. The idea was to put the cursors on a feature like a peak on two traces that should be aligned, and then change whatever is needed to align them. It works on both waveforms and XY traces. See Analysis->Packages->Wave Arithmetic. There is a demo experiment as well, File->Example Experiments->Analysis->Wave Arithmetic Panel Demo.

It is not built to handle large batches of waves, though, so it perhaps doesn't completely answer your need.

In reply to by jcor

jcor wrote:

Thanks for your comments. 

It could be changed to double click and hold. Or require CTRL. Or something.

I would bet pretty heavily that almost nobody uses this feature *and* that the kind of person who uses it is the kind who will figure it out for themselves what the change was.

I'm getting some pushback here as far as adding a preference. We used to regularly get complaints about accidentally dragging until we increased the delay. We haven't gotten any recently. You mentioned originally that you use a trackpad on your laptop. Do you encounter this problem when you try to drag out a marquee? or move graph cursors?

In reply to by johnweeks

johnweeks wrote:

 

jcor wrote:

 

Thanks for your comments. 

It could be changed to double click and hold. Or require CTRL. Or something.

I would bet pretty heavily that almost nobody uses this feature *and* that the kind of person who uses it is the kind who will figure it out for themselves what the change was.

 

 

I'm getting some pushback here as far as adding a preference. We used to regularly get complaints about accidentally dragging until we increased the delay. We haven't gotten any recently. You mentioned originally that you use a trackpad on your laptop. Do you encounter this problem when you try to drag out a marquee? or move graph cursors?

First of all I need to acknowledge that I lost my bet!

Second, no, I do not experience that (i.e., my trackpad doesn't seem to click by accident any other time). I do also experience this with the mouse. I guess I am just a messy clicker.

The ideal solution would be that the Undo button would work for this event (i.e., embed a ModifyGraph TraceOffset command with the itnitial position). That would make me very happy, and probably not upset anyone else.

Thanks for the follow up John.

Hm. At least in 8.04, Edit->Undo works to undo the offset.

First of all I need to acknowledge that I lost my bet!

That's very gracious of you, especially after the readers here kind of piled on :)

I am sorry for getting off-topic once more.

@Tony: You may have seen that I since released a polished version of the offset panel as a project. I was playing around a bit with you nice StackTraces tools, but (at least for now) I didn't find a consistent way to implement something together with panels. Here is just a small thing I noticed: Some of the StackTraces functions do not play well with pseudo-waterfall plots of 2D waves (i.e., each column is one trace) because the code assumes that each trace is its own wave (or a pair of XY-waves). That is of course easy to implement (if you want to go for it) by detecting 2D data and then pulling out the respective column as a free wave for processing.

Unfortunately, almost none of my spectroscopy code supports 2D traces. I never really intended to distribute the stack traces thing, and since I don't usually work with 2D traces I didn't think much about it. In fact, I went to some length to avoid using 2D traces where they would arguably be the right thing to use. Maybe it's easier than I imagine, but already supporting both waveform and XY traces took a lot of code wrangling in the archull, baseline spline and baseline fitting projects.

I have been making an effort over the last few years to clean up and release more of my 'everyday' time-saving code. If you can find a way to add a couple of the stack traces functions (align traces, then add an offset multiple to each trace) to your super panel, I can forget about the stack traces code!

I see. OK, then I will give StackTraces another look. I think it is no big deal to adapt the code for 1D, XY and 2D traces (or sidestep this problem altogether by just using the trace info itself). The biggest roadblock is probably that I have no clear idea what some of the options actually do at the moment. But an afternoon with a clear head should solve this problem. So is it OK if I incorporate the functionality into the TraceOffset panel? I will refer to your efforts in the code, of course.

In reply to by chozo

You are welcome to take anything from the code I post here.

I realize that with no documentation, stack traces is not much use. Here is a typical use case for me: a student arrives with a pile of new, unprocessed spectra. They plot as a tangled mess. Rather than doing careful baseline corrections, I first align the spectra at some point by adding an appropriate y offset, the add a further offset*i to each trace trace number i so they are offset more-or-less uniformly in the vertical direction. I would likely also use a trace coloring shortcut, similar to what you already have in your panel. In a couple of seconds I can start to interpret the data. If I can do that with your panel it does most of what I use stack traces for.

Here is a more detailed explanation for the stack traces menu items:

Trace menu:

'align traces here', adds an offset to all other traces so that they are vertically aligned with the chosen trace at the click position

'reorder at point value', reorders traces such that [y(x) + offset] increases monatonically in the plot order at the clicked x value.

Trace and graph popup menus:

'stack traces equal gap', adds an offset to each trace such that they are spread between the limits of the Y axis, and the gap between the maximum and minimum plotted values of trace i and trace i+1 are equal. I rarely use this.

'stack traces equal offset', adds an offset to each trace such that they are spread between the limits of the Y axis, and the gap between the maximum plotted values of trace i and trace i+1 are equal. This works for traces that need no baseline correction.

'stack aligned traces', adds an additional offset y0 to trace 0 so that lowest visible value plots at Y min, adds an addition offset yN to last trace so that max visible value plots at y max, and for intermediate traces adds an additional offset y0 + (yN-y0)*i. This works for traces that require baseline correction, but have been previously aligned by setting offset values.

'add offsets' prompts for a value and adds value*i to offset of trace i.