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.

Change scales for repeated Charts

See original GitHub issue

Not all repeated columns / rows have the same scales. It would be useful not enable different for different columns / rows

I do not know what the API should look like since I am not very familiar with this code base. but I thought of this: make repeated able to take fully specified encoding to be modified

import altair as alt
from vega_datasets import data
iris = data.iris.url

chart = alt.Chart(iris).mark_point().encode(
    alt.repeat("column"),
    alt.Y(alt.repeat("row"), type='quantitative'),
    color='species:N'
).properties(
    width=200,
    height=200
).repeat(
    row=[
        alt.X('petalLength', type='quantitative', scale=alt.Scale(base=10, log=True)), 
        alt.X('petalWidth', type='quantitative', scale=alt.Scale(base=10, log=False))],
    column=['sepalLength', 'sepalWidth']
).resolve_scale().interactive()

The code above raises the error below

---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
<ipython-input-13-573643beab36> in <module>
      6     alt.repeat("column"),
      7     alt.Y(alt.repeat("row"), type='quantitative'),
----> 8     color='species:N'
      9 ).properties(
     10     width=200,

C:\anaconda3\lib\site-packages\altair\vegalite\v3\api.py in encode(self, *args, **kwargs)
   1385     def encode(self, *args, **kwargs):
   1386         # Convert args to kwargs based on their types.
-> 1387         kwargs = utils.infer_encoding_types(args, kwargs, channels)
   1388 
   1389         # get a copy of the dict representation of the previous encoding

C:\anaconda3\lib\site-packages\altair\utils\core.py in infer_encoding_types(args, kwargs, channels)
    467         if encoding is None:
    468             raise NotImplementedError("positional of type {}"
--> 469                                         "".format(type_))
    470         if encoding in kwargs:
    471             raise ValueError("encoding {} specified twice.".format(encoding))

NotImplementedError: positional of type <class 'altair.vegalite.v3.schema.core.RepeatRef'>

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
jakevdpcommented, Aug 5, 2020

Hi @crypdick – I don’t think there is a way to adjust individual scale parameters in a repeated chart. To do that, you’d have to manually concat the subcharts.

P.S. Good to see you again 😁

0reactions
crypdickcommented, Aug 5, 2020

@jakevdp One thing I haven’t been able to find documentation for is how to make some columns of a repeat chart log-scale. For example, how do I make the learning rate and L2 penalty x-axes log-scale (but not dropout)?

hyperparam scaling

    chart = alt.Chart(data).mark_circle().encode(
        alt.X(alt.repeat("column"), type='quantitative',scale=alt.Scale(zero=False, padding=0.01)),
        alt.Y(alt.repeat("row"), type='quantitative', scale=alt.Scale(zero=False, padding=0.01)),
    ).repeat(
        column=['Learning Rate', 'L2 Penalty', 'Dropout'],
        row=['val/avg_precision' ]
    )

P.S. I just discovered Altair and it’s already my favorite Python viz package. P.P.S. you taught me how to use Numpy circa 2014 at UW P.P.P.S. Sorry for the necro post

Read more comments on GitHub >

github_iconTop Results From Across the Web

Same axis scales across multiple charts in Excel - YouTube
00:00 Set all Excel charts to have the same scale00:07 Set up the first column chart00:16 Trick to create multiple charts without repeating...
Read more >
Consistent Axis Scales Across Multiple Charts
This tutorial shows a simple, reliable, non-programmatic method for synchronizing axis scales in multiple charts.
Read more >
Change the scale of the horizontal (category) axis in a chart
In a chart, click the category axis that you want to change, or do the following to select the axis from a list...
Read more >
How to Make a Radar Chart with Different Scales in Excel?
Essentially, data visualization charts change the way you access, present, ... Video Tutorial: How to Create a Radar Chart with Multiple Scales in...
Read more >
Adjusting scales on axes - TIBCO Product Documentation
When you use the Dual scales option, there is one scale to the left and one scale to the right on the Value...
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