Suggested .octaverc for GNU Octave

1 minute read

Octave 4.2 brought startup.m persistent user settings like Matlab. To keep Matlab compatibility, put Octave-specific startup commands into ~/.octaverc.

Ubuntu 18.04 comes with Octave 4.2 in the default repos. It’s nice that Ubuntu 18.04 Terminal octave starts only the command line interface, and via the Activities menu Octave GUI is accessed.

I also put default plotting parameters into ~/.octaverc because I don’t want to mess up Matlab’s defaults, particularly for HiDPI systems where each program handles HiDPI in their own way.

Suggested

This is a suggested ~/.octaverc, edit to your tastes. It sets default parameters for all GNU Octave sessions on your computer.

suppress_verbose_help_message(1)
page_output_immediately(1)
page_screen_output(0)
crash_dumps_octave_core(0)
sigterm_dumps_octave_core(0)
sighup_dumps_octave_core(0)

EDITOR('nano > /dev/tty 2>&1 < /dev/tty %s')

if exist('~/Documents/MATLAB/startup.m', 'file')
  source('~/Documents/MATLAB/startup.m')
endif
*_dumps_*
eliminate nuisance octave-workspace files that appear when Octave is ctrl-c exited or crashes.
page_output_immediately(1)
make Octave print immediately like Matlab.
if exist
use startup.m file like Matlab.

Set plot defaults

Particularly useful for HiDPI systems, control Octave default plot text size of axes and titles, useful for HiDPI systems by adding to ~/.octaverc:

set(0,"defaultaxesfontsize",16)
set(0,"defaultlinelinewidth",2)

adjust 16 to produce the most appealing text labels in:

  • axes tick labels
  • legend key
  • title text

defaultline is the root category for lines, so defaultlinelinewidth is not a typo.

Speedup Octave start (without GUI)

add to ~/.bash_aliases

alias octave="octave-cli -q --braindead"

and be sure you’re not autoloading Octave packages

Notes

Leave a Comment