Well whattya know. Another Octave feature here; I stumbled across this when finding a solution to the following original problem. I was looping to make a large number of plots that I was printing to pdf files, and since it was taking a while and the new plots kept getting in my way on the screen, I turned off the screen plots via:
h=figure;
set(h,'visible','off');
plot...
Problem was, while that stopped the plots from showing on the screen, still every time a new plot figure was called the cursor focus would go back to the X11 app (I'm on OSX) which made it awfully frustrating to work in another terminal window. (This doesn't happen in Matlab by the way; in Matlab the set(h,'visible','off') appears to be enough.) After much searching and experimentation I finally discovered that I could preface the above with a line to change the graphics terminal type in Octave to cut X11 out of the loop, like this:
putenv('GNUTERM','dumb');
That form works in Octave 3.4.0; the earlier form of "set terminal dumb" doesn't seem to work anymore. Anyway, that solved my trouble of the reverting cursor focus and made me happy. But then I found what else that dumb-terminal setting is good for -- making good old-fashioned ASCII plots! Remember those? I suppose you need to be of a certain age to really appreciate this. Here's the idea by way of an example:
octave-3.4.0:15:44:07> putenv('LINES','30');
octave-3.4.0:15:48:54> putenv('COLUMNS','70');
octave-3.4.0:15:48:56> putenv('GNUTERM','dumb');
octave-3.4.0:15:48:59> plot(r_TCTD,c_TCTD([1,3,5],:)); \
> xlabel('range (km)'); title('soundspeeds (m/s) in towed seacable sensors')
+--------------------------------------------------------------------+
| soundspeeds (m/s) in towed seacable sensors |
| |
|1540 ++--------+---------+---------+---------+---------+--------++ |
| + + + + + + + |
| | | |
|1538 ++++++++ ++ |
| | +++++++++++ + | |
| | ++++ +++++++ ++++++ | |
|1536 ++ ++++++++++ +++++++++++++++++++ + ++ |
| | ++ | |
| | + | |
|1534 ++++++++++ + ++ |
| | + ++++++++++ | |
| | ++++++++ +++++++ ++++ + | |
|1532 ++ ++++++++++ ++++ ++++++++++++ +++ ++ |
| | +++++ +++++ | |
| | + + + | |
|1530 ++++++++++ +++++ ++ |
| | + +++ + ++ | |
| | ++++ +++++++ ++++++ | |
|1528 ++ + +++++++++++++ ++++ ++++++++ ++ |
| | + ++ ++ +++++ ++++ | |
| + + + + + +++ ++ + |
|1526 ++--------+---------+---------+---------+---------+--------++ |
| 440 445 450 455 460 465 470 |
| range (km) |
+--------------------------------------------------------------------+
And there you have it -- plot your stuff to the ASCII terminal instead of some boring old publication quality PS or PDF file! Now, WHY would you ever bother to do this? Ok, honestly I can't really think of a reason, but it's the way we used to check over results on-screen before printing out to the printer, you know, kindof a few years ago. Just think of it as "retro"...
Hey, it was good for 10 minutes of mindless diversion in any case! And I do have the excuse that finding this dumb-terminal setting really saved the day for turning off the on-screen plots/focus issue. Just lastly, note I did find that this ASCII plotting didn't work in Octave v3.2.3, but the dumb terminal is still available in that version by the same command, and at least still took care of the screen-focus issue.
It can be useful too:
ReplyDeleteI work remotely on some server, and sometimes there is no X11 forwarding, or the forwarding is very slow. And in cases you only want to view some results, without printing, it can help.
Thanks!
It's useful for me: my terminal has an unlimited history, so I can scroll up and see rough ASCII plots from several hours in the past. These plots don't take up any real memory or desktop space. Small benefit, but it's something.
ReplyDelete