NCAS-CMS / NCAS-CMS/cf-plot

Increase default width of colour bar on all plots for clarity/readability

Open
#78 3 comments 0 reactions 1 assignee View on GitHub

@sadielbartholomew is already working on this.

Since Oct 7, 2024.

enhancement image-based plotting
Dominant language
Python
Stars
21
Forks
11
Avg merge
7h 11m
Merged PRs (30d)
1

Description

The default colour bar width strikes me as too thin, in that it can be fairly to very difficult to see the colours inside it depending on how large you are viewing the plot ('very' when it is smaller) and therefore not particularly readable or clear. Morevoer, other visualisation tools I have seen in use in the field have thicker colour bars, in some cases much thicker such as Iris (see https://scitools-iris.readthedocs.io/en/stable/generated/gallery/index.html for the gallery), which suggests it is normal and preferred that way.

I asked a sample of colleagues whether they agreed the default width is too thin and they overwhelmingly (i.e. all surveyed) did. I included plots varying the width to try to gauge what the new default should be, and it seems like colorbar_thick should be increased to 0.035 from the current default of 0.015.

New default width judegement

I did a quick survey via NCAS Slack with a representative (two-line snippet from the docs example 1) with colorbar_thick varying from the default 0.015 then 0.02 to 0.04 in 0.01 increments (see below), and about half thought the 0.03 plot had the most suitable width, and about half the 0.04 width (including people who thought either of those two were best), hence I think inbetween is the best choice, 0.035.

Though I show a contour plot to illustrate, the width default increase will need to be implemented across all plots for universal benefit of the increase and for consistency.

Code and outputs to compare

I varied the colorbar_thick keyword from the default as follows:

>>> f=cf.read('cfplot_data/tas_A1.nc')[0]
>>> cfp.gopen(file="default-colorbar.png")
>>> cfp.con(f.subspace(time=15))
>>> cfp.gclose()
>>> cfp.gopen(file="new0.2-colorbar.png")
>>> cfp.con(f.subspace(time=15), colorbar_thick=0.02)
>>> cfp.gclose()
>>> cfp.gopen(file="new0.3-colorbar.png")
>>> cfp.con(f.subspace(time=15), colorbar_thick=0.03)
>>> cfp.gclose()
>>> cfp.gopen(file="new0.4-colorbar.png")
>>> cfp.con(f.subspace(time=15), colorbar_thick=0.04)
>>> cfp.gclose()

where the outputs are:

  1. 0.015, current default
    default-colorbar

  2. 0.02
    new0 2-colorbar

  3. 0.03
    new0 3-colorbar

  4. 0.04
    new0 4-colorbar

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.