File: config.md

package info (click to toggle)
bornagain 23.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 103,948 kB
  • sloc: cpp: 423,131; python: 40,997; javascript: 11,167; awk: 630; sh: 318; ruby: 173; xml: 130; makefile: 51; ansic: 24
file content (70 lines) | stat: -rw-r--r-- 1,905 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
+++
title = "Configuration"
weight = 50
+++

# Plot configuration

Images in BornAgain examples are generated using the Python library
[MatPlotLib](https://matplotlib.org).

Default settings can be overridden
by function arguments or MatPlotLib ressources.

Exceptionally, [heat map](heatmap) supports an environment variable.

### Parameterization with plotargs

In the functions
```
plot_simulation_result(result, **plotargs)
plot_multicurve(results, **plotargs)
make_plot(results, ncol, **plotargs)
make_plot_row(results, **plotargs)
```
the placeholder `**plotargs` stands for optional keyword arguments.
These can be supplied in three ways:

(1) Directly like in
```python
    bp.plot_simulation_result(result, cmap='viridis', legendloc='lower right')
    bp.plt.show()
```

(2) Through a dictionary variable like in
```python
    plotargs = {}
    plotargs['aspect'] = 'auto'
    plotargs['intensity_min'] = 1e-12
    plotargs['intensity_max'] = 1e2
    bp.plot_simulation_result(result, **plotargs)
    bp.plt.show()
```

(3) If a script contains the lines
```python
    plotargs = bp.parse_commandline()
    bp.plot_simulation_result(result, **plotargs)
```

then parameters can be passed from the command line, like
```bash
python3 <script> intensity_min=1e-9
```

### Supported arguments

Support keyword arguments include

* `figfile`, only in combination `bp.export`, see [Export](export).
* `intensity_min`,
* `intensity_max`,
* `xlabel`,
* `ylabel`,
* `zlabel`,
* `legendloc`: where a legend is placed,
* `aspect`: [aspect ratio](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.set_aspect.html), default is 'auto', other possible values are 'equal', or a number,
* `cmap`: see [heat map](heatmap).

For other optional arguments that may or may not be respected, see
the [MatPlotLib customizing tutorial](https://matplotlib.org/stable/tutorials/introductory/customizing.html).