Proposed changes to title interface
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 576
- Forks
- 234
- PR merge metrics
- No merged PRs in 30d
Description
There has been several issues brought up (#91, #94, #95, #107) where the best solution would be a retooling of the API for controlling the value and uncertainty in the titles. I am willing to implement it, but I would like to discuss what we want before I put in the time.
I propose deprecating show_titles and replacing it with titles. For now both will still be available to maintain backwards compatibility, but using show_titles will produces a deprecation warning. The code will ignore show_titles if titles is used.
`show_titles=True` # produces an import warnings
titles=True # backwards similar behavior: median & 1 sigma errors with everything else at default values.
titles=[value1, value2, ...] # string or number for each title value. numbers will be formatted according to `title_fmt`.
show_titles=True, titles=[value1, value2, ...] #`title` wins out and is implemented
I propose adding a new keyword, title_errors. This allows the user to control the errors presented in the titles. The default will maintain backwards compatibility. This will allow for using values giving to quantiles, defining unique quantiles, or accepting user define numbers.
title_errors=None # default and backwards compatible. Defaults to `title` & `title_fmt` to determine what is displayed.
title_errors=True # uses min and max of `quantiles`, like what the old documentation said was available
title_errors=False # have titles not display any error values
title_errors=(.1, .9) # any two quantiles.
title_errors=[(pvalue1, nvalue1), (pvalue2, nvalue2), ...] # array_like[ndim,2] values can be strings
# or numbers. Just uses the values that are given. Numbers will be formated according to `title_fmt`.
A user can set titles and title_errors as array_like, therefore fully defining the content in the titles, but these proposals also keep backwards compatibility with code already written.
We can make a similar change to title_fmt to allow it to take an array of stings. This avoids issues like the one in Dhawan 2017 figure 4 where parameters need different levels of precision.
title_fmt=".3f" # functionality is unchanged
title_fmt=None # functionality is unchanged
title_fmt=[fmt1, fmt2, ...]
Here is my proposed new docstings for the relevant keywords.
"""
show_titles : bool
DEPRICATED: for new code, use `titles` instead.
Displays a title above each 1-D histogram showing the 0.5 quantile
with the upper and lower errors at 0.16 and 0.84 quantiles.
Argument is ignored if `titles` is used.
titles : bool or array_like[ndim,]
Displays a title above each 1-D histogram. If set to `True` will state the 0.5 quantile.
An array of stings or numbers can be given to be used for each value. Errors are
defined by `title_errors`, but defaults to upper and lower errors at 0.16 and 0.84
quantiles. All numbers will be formated via `title_fmt`.
title_errors : bool, array_like[2], or array_like[ndim, 2]
Controls the values of the errors in the titles above the 1-D histograms. Defaults
to `None`, and uses the upper and lower errors at 0.16 and 0.84 quantiles if
needed. If `True`, uses the minimum and maximum values of supplied to
`quantile`. If `False`, does not display errors. If a length 2 array_like, uses these
as quantiles. They are required to be fractional values. Finally each upper and
lower value can be defined as a 2-D array of positive values of the form
`[(pvalue1, nvalue1), (pvalue2, nvalue2), ...]`. These values can be strings or
number and numbers are formated following the `title_fmt` keyword.
title_fmt : string or array_like[ndim,]
The format string (or array of strings) for the quantiles given in titles. If you
explicitly set ``titles=True`` and ``title_fmt=None``, the labels will be
shown as the titles. If title_fmt=None and title=array_like does what?
(default: ``.2f``). Ignored if `titles` and `title_errors` are given sting values
"""
I am submitting this issue so we can discuss this before I implement it. In that vain, I do have two question about these proposals. Is deprecations of show_titles the best option? Should title_errors default to None and the hard coded values, or set up a new default that follows what is currently documented even though that was not the current way it is implemented?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing handling and documentation for show_titles, title_fmt, quantiles, and title display behavior. Before implementation, resolve the proposed API and backward-compatibility questions in the issue; done means the design is agreed and the resulting behavior and documentation are specified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100