Skip to content

DOC: scales - built in options and custom scale usefulness #29404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 11, 2025

Conversation

rcomer
Copy link
Member

@rcomer rcomer commented Jan 5, 2025

PR summary

Today I spent way too long trying to wrap my head around why someone might write a custom scale. I have updated the example with what I think I have understood. Also updated the set_[xy]scale docstring as it was missing some built-in options, and I think we can be clearer about what happens to **kwargs.

PR checklist

@rcomer rcomer added this to the v3.10.1 milestone Jan 5, 2025
@rcomer rcomer changed the title DOC: scales - built in options and custom usefulness DOC: scales - built in options and custom scale usefulness Jan 5, 2025
value : {"linear", "log", "symlog", "logit", ...} or `.ScaleBase`
The axis scale type to apply.
value : str or `.ScaleBase`
The axis scale type to apply. Supported string values are "linear", "log",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you somehow integrate a link to https://matplotlib.org/devdocs/api/scale_api.html (maybe directly to the table (?) by adding a rst label before the table). The strings alone give a rough idea, but the link would give the ability to read up un what they mean and which kwargs are supported. You then may or may not leave out the explicit bullet list of classes under kwargs. Alternatively, create a table/bullet list (str name: class) under the value attribute to make the connection here, but still link out for additional context.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of just linking to the table (which I didn't know was there!) Having the information in one place means we don't have to worry about keeping two versions in sync.


If you do not need any of the above, then you probably don't need to use this
verbose method, and instead can use `~.scale.FuncScale` and the ``'function'``
option of `~.Axes.set_xscale` and `~.Axes.set_yscale`. See the last example in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional note: I think we should make the FuncScale case more prominent. Not only as "last example in ...". Either as a top level example in parallel to this example, or by making two subsections in this example.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no objection to this, but also not the bandwidth right now.

@@ -3,7 +3,9 @@

The mapping is implemented through `.Transform` subclasses.

The following scales are builtin:
The following scales are built-in:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merriam-Webster says this is hyphenated, though we seem to have both ways all over the docs...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ChatGPT says:

The correct spelling depends on how the term is used in a sentence:

  1. "Built-in" (with a hyphen) is an adjective. It is used to describe something that is an integral or permanent part of something else.

    • Example: "The phone has a built-in camera."
  2. "Builtin" (no hyphen) is not a standard English word, but it is sometimes used as a term in programming or technical contexts, especially in filenames, identifiers, or codebases. For instance, Python has "builtin functions," though even here, "built-in" is more widely accepted in official documentation.

To summarize:

  • For general usage, "built-in" with a hyphen is correct.
  • For programming or technical contexts, check the convention of the specific language or framework being used.

@timhoffm timhoffm merged commit 445f0d0 into matplotlib:main Jan 11, 2025
37 of 39 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Jan 11, 2025
@rcomer rcomer deleted the custom-scale branch January 11, 2025 23:27
timhoffm added a commit that referenced this pull request Jan 12, 2025
…404-on-v3.10.x

Backport PR #29404 on branch v3.10.x (DOC: scales - built in options and custom scale usefulness)
@ksunden ksunden mentioned this pull request Mar 3, 2025
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants