Skip to content
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

facet fails on arc #8754

Closed
mattijn opened this issue Mar 2, 2023 · 1 comment · Fixed by #9232
Closed

facet fails on arc #8754

mattijn opened this issue Mar 2, 2023 · 1 comment · Fixed by #9232
Labels

Comments

@mattijn
Copy link
Contributor

mattijn commented Mar 2, 2023

Given the following vega-lite spec:

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.6.1.json",
  "data": {
    "values": [
      {"t": 0, "v": 2, "c": "foo"},
      {"t": 1, "v": 2.5, "c": "foo"},
      {"t": 2, "v": 3, "c": "foo"},
      {"t": 3, "v": 4, "c": "foo"},
      {"t": 4, "v": 5, "c": "foo"},
      {"t": 5, "v": 5.5, "c": "foo"},
      {"t": 6, "v": 4, "c": "foo"},
      {"t": 7, "v": 3, "c": "foo"},
      {"t": 0, "v": 2, "c": "bah"},
      {"t": 1, "v": 2.5, "c": "bah"},
      {"t": 2, "v": 3, "c": "bah"},
      {"t": 3, "v": 4, "c": "bah"},
      {"t": 4, "v": 5, "c": "bah"},
      {"t": 5, "v": 5.5, "c": "bah"},
      {"t": 6, "v": 4, "c": "bah"},
      {"t": 7, "v": 3, "c": "bah"}
    ]
  },
  "mark": {"type": "arc"},
  "encoding": {
    "color": {"field": "v", "type": "quantitative"},
    "column": {"field": "c", "type": "nominal"},
    "radius": {"field": "v", "type": "quantitative"},
    "theta": {"field": "t", "type": "nominal"}
  },

}

I see:
image

Open the Chart in the Vega Editor

It seems it is not possible to facet an arc-mark.

Removing the "column": {"field": "c", "type": "nominal"} gives a single chart:
image

Altair python code:

import altair as alt
import pandas as pd

base = pd.DataFrame(
    {"t": range(8),
     "v": [2, 2.5, 3, 4, 5, 5.5, 4, 3]}
)
cA = base.copy()
cA.loc[:, 'c'] = 'foo'
cB = base.copy()
cB.loc[:, 'c'] = 'bah'

source = pd.concat((cA, cB))
source.head()

arcs = alt.Chart(source).mark_arc().encode(theta="t:N", radius="v:Q", color="v:Q", column="c:N")
arcs

Related: #3729

@ChiaLingWeng
Copy link
Contributor

ChiaLingWeng commented Jan 22, 2024

for this issue, I added width and height in config and it works,
since I saw they are 0 in signal viewer, not sure if this info helps
{"width": 200,
"height": 200}

domoritz added a commit that referenced this issue Jan 30, 2024
close #8754 
I found that the range for radius using width and height without
checking if the model is faceted

https://github.com/vega/vega-lite/blob/c33f46bad7f80f779e463a8a36481f888f18e222/src/compile/scale/range.ts#L311-L314

---------

Co-authored-by: GitHub Actions Bot <vega-actions-bot@users.noreply.github.com>
Co-authored-by: Dominik Moritz <domoritz@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants