Add a 'set_ticks' PlotHelper function enabling setting tick locations and labels
This MR implements a slight wrapper around matplotlib's ax.set_*ticks
and ax.set_*ticklabels
functionality in the plot helper in form of a _hlpr_set_ticks
function.
Details
The _hlpr_set_ticks
function enables setting the tick locations and labels in a graph. It is necessary to specify the axis on which to set the ticks as well as whether the ticks are major or minor. The functionality best understood by looking at the helper_funcs.yml
test configurations. Additionally, I added a use-case example of a configuration and its resulting graph below.
Use-case example
To see the functionality,
set_ticks:
x:
major:
locs: [0,1,2,3,4,5,6,7]
labels:
- None
- Energy
- Interaction prob
- Investment
- Payoff
- Random
- Strength
- Goods
rotation: vertical
y:
major: [0, 1, 2]
minor:
locs: [0.5, 1.5]
labels:
- Minor tick 0.5
- Minor tick 1.5
Anything to double-check?
-
Should we raise an error if either of the major
/minor
is missing within an axis dict? -
In general, should we add more checks for parameter validity? -
Doc-string understandable?
Can this MR be accepted?
-
Implementation ready -
Tests added or adjusted
-
Code quality -
Changes follow coding guidelines -
Checked code coverage on new and adjusted code
-
-
Ready for merging -
Pipeline passes without warnings -
History cleaned-up or squash option set -
Changelog entry added -
Version number bumped -
Reviewed & approved by @
-
Related issues
Edited by Utopia Developers