Altair: Usability Enhancements

Created on 1 Nov 2016  路  7Comments  路  Source: altair-viz/altair

A couple collected usability enhancements that require non-trivial changes

  • [x] Address the too-large notebook issue. I think the best option would be to allow a png-only mode for embedding (requiring a change to ipyvega) (See #249)
  • [x] Address silent failure when ipyvega is not correctly installed/activated (See #200)
  • [x] Address silent failure when spec is invalid (probably needs to happen in Vega/Vega-lite itself) Printing errors to the JS console is not much of a help to Python users.
enhancement

Most helpful comment

Hello, I have three more enhancements I'd like to request. I am hitting these issues because I'm making slides with Altair and I want to ensure some visual consistency.

  1. Ability to globally set font size, like this: Chart(font_size=16)
  2. Ability to globally set a fixed chart size, like this: Chart(chart_width=800)
  3. Ability to set a chart title

For font size it looks like I have to call configure_axis, configure_legend, configure_facet_axis to do this, which is doable, but it would sure be nice to have a convenience function for this.

I see Chart accepts a width parameter but the behavior is strange; I think for facetted charts I am setting the width of an individual cell, not the whole chart? I have to know how many facet cells there are and do some kind of calculation in order to get my desired chart width. This behavior seems non-intuitive to me. I'd appreciate a way of saying "800" and let the chart be 800 regardless of what's going on inside it.

Finally chart title, I saw that's pending somewhere in Vega-lite, I just want to add my support for this, it would be great to have for presentations, especially since charts have a way of getting copied and pasted outside their original context.

Many thanks!

All 7 comments

Hello, I have three more enhancements I'd like to request. I am hitting these issues because I'm making slides with Altair and I want to ensure some visual consistency.

  1. Ability to globally set font size, like this: Chart(font_size=16)
  2. Ability to globally set a fixed chart size, like this: Chart(chart_width=800)
  3. Ability to set a chart title

For font size it looks like I have to call configure_axis, configure_legend, configure_facet_axis to do this, which is doable, but it would sure be nice to have a convenience function for this.

I see Chart accepts a width parameter but the behavior is strange; I think for facetted charts I am setting the width of an individual cell, not the whole chart? I have to know how many facet cells there are and do some kind of calculation in order to get my desired chart width. This behavior seems non-intuitive to me. I'd appreciate a way of saying "800" and let the chart be 800 regardless of what's going on inside it.

Finally chart title, I saw that's pending somewhere in Vega-lite, I just want to add my support for this, it would be great to have for presentations, especially since charts have a way of getting copied and pasted outside their original context.

Many thanks!

@pteehan Thanks for your requests.

Ability to globally set font size, like this: Chart(font_size=16)

axis and legend config have tickLabelFontSize, titleFontSize and mark config has fontSize. If you set all of these to the same number, they should all have the same font size.

I don't know if we should really have single fontSize properties for different parts because we will have to introduce more complexity like which property has higher precedence. However, if you strongly think we should have it, you can file an issue in VL and I will discuss with our team.

Ability to globally set a fixed chart size, like this: Chart(chart_width=800)

This will be a part of VL 2.0 https://github.com/vega/vega-lite/issues/1647

Ability to set a chart title

https://github.com/vega/vega-lite/issues/431

Thank you @kanitw, much appreciated.

I do see a strong use case for the first point, so I'll make an issue in VL.

I am going to mark this as 1.3 as some of these issues are bad enough that they really cause problems.

I'd say a +1 on global font sizes.
Or, something like the equivalent of the following Matplotlib:

params = {'backend': 'ps',
              'text.latex.preamble': ['\usepackage{gensymb}'],
              'axes.labelsize': 8, # fontsize for x and y labels (was 10)
              'axes.titlesize': 8,
              'text.fontsize': 8, # was 10
              'legend.fontsize': 8, # was 10
              'xtick.labelsize': 8,
              'ytick.labelsize': 8,
              'text.usetex': True,
              'figure.figsize': [fig_width,fig_height],
              'font.family': 'serif'
    }

matplotlib.rcParams.update(params)

One way to do this might be to allow setting global config defaults, which are added to every JSON output when a chart is created. But in general I think global states like those used by matplotlib are a poor design choice, so I'd prefer to find some other way to do it.

Addressed in recent ipyvega/jupyterlab releases

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Juan-132 picture Juan-132  路  3Comments

SuperShinyEyes picture SuperShinyEyes  路  3Comments

fischcheng picture fischcheng  路  4Comments

zanarmstrong picture zanarmstrong  路  4Comments

mroswell picture mroswell  路  4Comments