NCAS-CMS / NCAS-CMS/cf-plot

`gpos` `pos` positional count begins at 1 when should be Pythonic 0

Open
#76 0 comments 0 reactions 1 assignee View on GitHub

@sadielbartholomew is already working on this.

Since Oct 3, 2024.

code hygiene
Dominant language
Python
Stars
21
Forks
11
Avg merge
7h 11m
Merged PRs (30d)
1

Description

The gpos function requires an integer argument pos to define the plot position. The first position is encoded by the value 1, but this is very un-Pythonic, since 0 which encodes the first position for mots of not all Python objects. In practice, this can making programmatic usage awkward, for example when iterating over something to assign sub-plots, a value i + 1 needs to be used instead of simply i, which would be much cleaner and understandable to those reading the code:

for i, proj in enumerate(<variable to change across subplots>):
    cfp.gpos(i + 1)
    <generate sub-plot with given variable choice>

So, we should set the position pos to being at 0 and count from there, not from 1. The pos argument could also be documented much more clearly, so this should be done when this change is made.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.