vitessce-python icon indicating copy to clipboard operation
vitessce-python copied to clipboard

Uneven size of views when using h_concat

Open sehilyi opened this issue 4 years ago • 4 comments

In the following examples, I expected that views A-D have same width, but the views on the right-most column have larger width than other views.

vc.layout((A | B | (C / D)) / E);
# or
vc.layout((A | (B / C) | D) / E);

(I was following this docs: https://vitessce.github.io/vitessce-python/notebooks/widget_pbmc.html)

Screen Shot 2021-01-05 at 1 36 27 PM

sehilyi avatar Jan 05 '21 18:01 sehilyi

In addition, the following code returns an error message.

vc.layout((umap | pca | cell_sets | genes) / heatmap);
Config validation failed
[
  {
    "keyword": "type",
    "dataPath": ".layout[0].w",
    "schemaPath": "#/definitions/components/items/properties/w/type",
    "params": {
      "type": "integer"
    },
    "message": "should be integer"
  }
]

I guess this is because the w value in react-grid-layout is accepting only integer values by a JSON schema, and adding many columns results the width less than 1.0. (1) I think the error message can be more understandable to users, or (2) allow double values (Although only the integer values are said to be officially allowed by react-grid-layout, I think double values work fine as well?).

sehilyi avatar Jan 05 '21 19:01 sehilyi

I think the first issue may be inherent to the magic syntax. Based on the way that operators are evaluated in python, I think (a | b | c) will always be evaluated as hconcat(hconcat(a, b), c) just like (1 + 2 + 3) would be ((1+2) + 3) as an abstract syntax tree.

But it is a good idea for us to write this in the documentation.

keller-mark avatar Jan 05 '21 19:01 keller-mark

If you dont mind I am going to split the grid issue into a separate issue

keller-mark avatar Jan 05 '21 19:01 keller-mark

Did not thought about the internal implementation of the magic syntax, but now it makes sense. It would be helpful if it is explained in the docs.

sehilyi avatar Jan 05 '21 19:01 sehilyi