Configuration#

List of xoa options#

Some options are accessible to alter the default behavior of xoa. These options are of a particular type and have a default value, as shown in the following table.

Flat view of available xoa options#

Name

Type

Default value

Description

meta.cache

boolean

False

Use the meta in memory cache

plot.cmapdiv

string

cmo.balance

Default diverging colormap

plot.cmappos

string

cmo.amp

Default positive colormap

plot.cmapneg

string

cmo.tempo_r

Default negative colormap

plot.cmapcyc

string

cmo.phase

Default cyclic colormap

plot.field_method

string

pcolormesh

Default method to plot fields

plot.section_method

string

pcolormesh

Default method to plot sections

plot.colorbar_shrink

float

0.7

Shrink factor of colorbars

plot.mesh_min_spacing

float

12

Minimal spacing in pixels between mesh centers in auto stride mode

plot.vectors_min_spacing

float

16

Minimal spacing in pixels between vectors in auto stride mode

plot.key_pos

float_list

['0.0', '1.03']

Position of the reference arrow in axes coordinates

plot.key_percentile

float

80

Percentile of the speed used to choose the reference arrow value

plot.stick_color

string

steelblue

Color of sticks

plot.stick_length

float

0.12

Length of the strong sticks in fraction of the axes width

plot.map_figsize

float_list

['8', '8']

Figure size in inches

plot.map_gridlines

boolean

True

Add labelled gridlines

plot.map_gridlines_labels_on

string_list

['bottom', 'left']

Sides of the gridline labels

plot.map_gridlines_linewidth

float

0.3

Line width of the gridlines

plot.map_gridlines_linestyle

string

--

Line style of the gridlines

plot.map_gridlines_color

string

gray

Color of the gridlines

plot.map_gridlines_labelsize

float

7

Font size of the gridline labels

plot.map_land

boolean

False

Add the land

plot.map_land_scale

string

110m

Natural earth scale of the land

plot.map_land_color

string

None

Face color of the land, cartopy default if not set

plot.map_coastlines

boolean

False

Add the coastlines

plot.map_bbox

boolean

True

Keep the frame of the axes visible

plot.map_fancy

boolean

False

Add a fancy black and white frame

plot.map_layer

boolean

False

Add the background layer

plot.layer

string

natgeo

Name of the default background layer, see the layers section

plot.layer_alpha

float

1.0

Opacity of the layer

plot.layer_zorder

float

0

Drawing order

plot.layer_attribution

boolean

True

Draw the attribution of the layer

plot.layer_attribution_size

float

5

Font size of the attribution

plot.layer_attribution_color

string

0.4

Color of the attribution

plot.scalebar_units

option

km

Units of the length

plot.scalebar_loc

string

lower left

Corner of the axes

plot.scalebar_pad

float

0.04

Distance to the corner in axes coordinates

plot.scalebar_segments

integer

2

Number of alternating segments

plot.scalebar_height

float

0.012

Height in axes coordinates

plot.scalebar_color

string

k

Color of the dark segments, labels and frame

plot.scalebar_zorder

float

10

Drawing order

plot.compass_loc

string

upper right

Corner of the axes

plot.compass_size

float

40

Height in points

plot.compass_style

option

simple

Style of the compass

plot.compass_color

string

k

Color of the dark parts

plot.compass_zorder

float

10

Drawing order

plot.fancy_width

float

5.0

Width in points

plot.fancy_colors

string_list

['k', 'w']

Alternating colors

plot.fancy_linewidth

float

0.6

Line width of the edges

plot.fancy_edgecolor

string

k

Color of the edges

plot.fancy_zorder

float

5

Drawing order

plot.flow_particles

integer

2000

Number of particles

plot.flow_alpha

float_list

['0.2', '1']

Opacity, or its ramp along the tracks

plot.flow_linewidth

float

0.3

Line width of the tracks

plot.flow_color

string

k

Color of the tracks

plot.minimap_loc

string

upper right

Location in the parent axes

plot.minimap_size

float

0.2

Size relative to the parent axes

plot.minimap_extent

float

1.0

Extent margin

plot.minimap_min_extent

float

2.0

Minimal extent in degrees

plot.minimap_gridlines

boolean

True

Add gridlines

plot.minimap_coords_markersize

float

10

Marker size of the point coordinates

plot.minimap_coords_linewidth

float

1.5

Line width of the coordinates

plot.minimap_coords_color

string

tab:red

Color of the coordinates

plot.minimap_coords_facecolor

float

0.2

Opacity of the coordinates area

plot.shadow_width

float

3

Shadow blur width in points

plot.shadow_xoffset

float

2

Shadow horizontal offset in points

plot.shadow_yoffset

float

-2

Shadow vertical offset in points

plot.shadow_alpha

float

0.3

Shadow opacity

plot.shadow_color

string

k

Shadow color

plot.glow_width

float

3

Glow width in points

plot.glow_alpha

float

1.0

Glow opacity

plot.glow_color

string

w

Glow color

plot.lightshading_width

float

7

Light shading width in points

plot.lightshading_fraction

float

1.0

Light shading fraction

plot.panel_style

string

{a})

Label format

plot.panel_loc

string

upper left

Label location

plot.panel_pad

float

0.03

Distance to the axes corner

Note

The xoa configuration system is based on the configobj package.

Setting options#

Permanent settings#

You can permanently change default settings by editing the xoa user configuration file, which is typically here on linux: ~/.local/share/xoa/xoa.cfg. Use the following command to see where this is located:

$ xoa info paths

This file is organised in sections, which correspond to the string before the dot “.” in the “flat” view of the option names.

Settings from a file#

Give the path of a config file with the same format to xoa.load_options() to keep its options for the session, or to xoa.set_options to use them temporarily as a context manager:

xoa.load_options("myproject/xoa.cfg")  # for the session

with xoa.set_options("myproject/xoa.cfg"):  # within the block only
    ...

Options are merged, so the file only needs to contain the ones to change. Unknown options and invalid values raise an xoa.exceptions.XoaConfigError.

Precedence, from the lowest to the highest: the default values, the user configuration file, the options loaded or set in python, and the arguments of the functions. The plot functions use the plot options when the corresponding arguments are None.

Inline settings#

You can change options from python with the xoa.set_option() function and the xoa.set_options class:

xoa.set_option("plot.cmapdiv", "cmo.balance")  # single option
xoa.set_options("plot", cmapdiv="cmo.balance", cmappos="cmo.amp")  # several options

xoa.set_options can be used as a context manager to temporarily change options within a block:

with xoa.set_options("plot", cmapdiv="cmo.balance"):

    # you code with temporary settings

# back to previous options

Getting options#

From commandline#

Default options are printable with the following command:

$ xoa info options

Options are organised in sections.

From python#

You can use the xoa.get_option() function to access a single option:

cmap = xoa.get_option('plot.cmapdiv') # flat mode
cmap = xoa.get_option('plot', 'cmapdiv') # section mode

The tutorial Set the options of xoa shows the options at work, with the cmap="auto" argument of the maps that chooses the colormap from the sign of the data.