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.

Subtitle Documentation and styling

See original GitHub issue

At last! There are subtitles in for altair charts(via a vega-lite update)! How splendid! This issue identifies a documentation bug and maybe a styling bug revolving around this newly birthed feature:

  • I don’t believe that there is any documentation of the mechanism for adding subtitles (or multiline titles) to charts! It’s a great feature it should be easy to find!

  • The title configuration section of the documentation appears to suggest that there should be various subtitle styling operators (subtitleColor, subtitleFont, subtitleFontSize, subtitleFontStyle, subtitleFontWeight, subtitleLineHeight, subtitlePadding specifically), but all of the variations that i’ve tried on them appear not to work? For instance the following should ostensibly produce a chart with a red subtitle

import altair as alt
from vega_datasets import data

chart = alt.Chart(data.cars.url).mark_point().encode(
    x='Horsepower:Q',
    y='Miles_per_Gallon:Q',
).properties(
    title={
      "text": ["First line of title", "Second line of title"], 
      "subtitle": ["Cool first line of subtitle", "Even cooler second line wow dang"]
    }
)

chart.configure_title(
    fontSize=20,
    font='Courier',
    anchor='start',
    color='gray',
   subtitleColor='red'
)

Unfortunately it produces a chart with an unstyled subtitle:

Screen Shot 2020-01-17 at 12 40 43 AM

I totally admit that i might be misreading this, but, if not, it seems like a bug. I’m happy to help contribute documentation once a solution is known

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

12reactions
mcnuttandrewcommented, Jan 17, 2020

Apparently it is both a documentation bug and a regular bug, after a helpful hint from @domoritz on the upstream issue, I was able to get the styling applied to the subtitle like so:

import altair as alt
from vega_datasets import data

chart = alt.Chart(data.cars.url).mark_point().encode(
    x='Horsepower:Q',
    y='Miles_per_Gallon:Q',
).properties(
    title={
      "text": ["First line of title", "Second line of title"], 
      "subtitle": ["Cool first line of subtitle", "Even cooler second line wow dang"],
      "color": "red",
      "subtitleColor": "green"
    }
)
chart
1reaction
palewirecommented, Apr 30, 2020

@jakevdp, I’m interested in the idea of adding examples to the gallery that tackle basic customizations like adding a subtitle. Would you be open to a new section there that showed how to do something like this? It seems like it would pretty tough for a newbie to figure out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Style Your Subtitles | Type Studio
A quick guide on how to style your subtitles to match your design by using Type Studio. Increase your view numbers with beautifully...
Read more >
subtitle - Documentation - Apple Developer
Displays text below the subtitle's containing element. ... tv-text-style. Sets a predefined size and style for text.
Read more >
Subtitle Writing Formats Explained... - Capital Captions
Almost identical visual format to SRT subtitles, though styling is available in terms of rendering, text formatting and position. Needs UTF-8 encoding and...
Read more >
Styling Captions - Video Cloud Studio Documentation
In this topic you will learn ways to style captions. ... select Settings > General > Accessibility > Subtitles & Captioning > Style....
Read more >
Style the Subtitle for a Cover - Paligo
By default, a publication topic contains a subtitle element that you can use to add a secondary title for a document. When the...
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