question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[DOCUMENTATION] Glyph Line, Text, and Fill defaults in theme yaml are undocumented

See original GitHub issue

The reference manual page for themes does not document the ability to set default line, text, and fill attributes for glyphs in the theme.yaml file. For example this is valid:

attrs:
  Axis: {}
  Grid: {}
  Plot: {}
  Title:
    text_color: '#f4a4c0'
  Toolbar: {}
fill_defaults:
  fill_color: '#e32400'
line_defaults:
  line_color: '#2b1276'
text_defaults:
  text_color: '#7a4900'
  text_font: Calibri

and has the effect, for example, of setting the default font in all Text Glyphs to “Calibri” unless specifically overridden by, for example, providing defaults for the Text Glyph. The relevant code is in theme.py where the constructor for the Theme class includes:

    self._line_defaults = self._json.get('line_defaults', _empty_dict)
    self._fill_defaults = self._json.get('fill_defaults', _empty_dict)
    self._text_defaults = self._json.get('text_defaults', _empty_dict)

and there is the method:

def _add_glyph_defaults(self, cls, props):
        from ..models.glyphs import Glyph
        if issubclass(cls, Glyph):
            if hasattr(cls, "line_alpha"):
                props.update(self._line_defaults)
            if hasattr(cls, "fill_alpha"):
                props.update(self._fill_defaults)
            if hasattr(cls, "text_alpha"):
                props.update(self._text_defaults)

The documentation also includes the somewhat cryptic annotation:

    The plotting API's defaults override some theme properties. Namely:
    `fill_alpha`, `fill_color`, `line_alpha`, `line_color`, `text_alpha` and
    `text_color`. Those properties should therefore be set explicitly when
    using the plotting API.

which merits more explanation.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:16 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
jeremy9959commented, Feb 22, 2020

My thought was yes, to use abstract classes and yes, that is what it would look like to the user. I will do some experimentation to see what this is like in practice. Incidentally I also understand what is going on with #6821. I can make a PR to clear that up but before I do I could use some guidance as to what seems most reasonable, it’s described there.

0reactions
bryevdvcommented, Feb 21, 2020

If you mean create purely abstract FilledGlyph etc, that seems reasonable though we should add tests to make sure e.g. that all FilledGlyph subclasses do in fact add fill properties. (And add the same kind of tests for XYGlyph too)

If you mean actually adding the properties on FilledGlyph that’s not impossible, but would require additional work to the documentation automation to make sure that the help strings for the inherited properties can still be customized on a per-class basis. (And I am not sure how hard that would be offhand.)

Do you then imagine this is what things would look like for users?

attrs:
    FilledGlyph:
        fill_alpha: 0.5
Read more comments on GitHub >

github_iconTop Results From Across the Web

Full list of theme.yaml lines - Home Assistant Community
We have a default theme in HA, you can create your own theme for HA. But what are the possible lines to edit...
Read more >
What's new? — ProPlot documentation - Read the Docs
Now gridlines appear on top of pcolor meshes by default, just like filled contours. ... Change the sample show_fonts text with math keyword...
Read more >
sitemap-questions-403.xml - Stack Overflow
... .com/questions/1343327/flex-3-alert-text-doesnt-stretch-to-fill-space ... https://stackoverflow.com/questions/4891906/jquery-mobile-default-data-theme ...
Read more >
Docutils To Do List - SourceForge
Support for subdocuments (see large documents). Object numbering and object references. Nested inline markup. Python Source Reader. The HTML writer needs ...
Read more >
My Emacs Configuration - Justin Abrahms
(use-package doom-themes :config ;; Global settings (defaults) ... (use-package fill-column-indicator) ;; line indicating some edge column ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found