vegawidget/vegabrite

vl_encode; vl_facet_wrap; vl_add_properties

Closed this issue · 4 comments

Hi @AliciaSchep,

Further to #17 , please see attached another set based on the old version.
vlbuildr_set_02_old_vs_new.pdf
set02_vlbuildr_old_vs_new.txt

Some charts may not render properly or codes will fail in the new version. For instance, the first chart Income in the U.S. by State, Faceted over Income Brackets will not be visualized properly.
vl_encode( say .. row= list() is not available ) may not have all parameters available in Vega-Light and in the old version.

vl_add_properties() and vl_mark() seem to be deprecated. I used a lot vl_add_properties in the old version. It is likely that vl_chart() may be used now in most cases, but piping worked naturally for vl_add_properties().

vl_facet_wrap seems to lose columns parameter to specify the number of columns with default being set for 2 only. In the new version, a message may point to an error in .add_facet.vegaspec_unit.

Thanks for these examples and bug reports!

The vl_add_properties is a bug that should get fixed soon; not meant to be deprecated. That behavior for vl_facet_wrap is also a bug that should get fixed!

I wasn't sure if the vl_encode and vl_mark functions added value compared to just having all the vl_encode_* and vl_mark_* families of functions so I removed them (but should have instead maybe soft deprecated or something). Happy to reconsider that if you find them useful.

Issue with vl_add_properties should now be fixed in latest master branch. Will try to fix vl_facet_wrap in next few days.

Thank you very much, @AliciaSchep!

vl_mark is handy, but may be replaced. Still prefer alternatives. I am not sure about vl_encode, though. vl_encode_tooltip vs vl_encode(tooltip = list of lists...)? Or, with reference to an example for Income in the U.S. by State Faceted over Income Brackets: would you consider vl_facet_row(field = "group", type = "nominal") as an alternative to vl_encode(row=list(field = "group", type = "nominal"))?

Maybe soft deprecating functions that proved to be redundant is a good solution with a short message as to the preferred option?

Regarding spec validation error messages, I find them restrictive, but useful (as they are supposed to be). Just a little bit confused about some validation issues for a code that runs smoothly and by the number in the old version.

I was confused, apparently -- vl_encode is still around it just is more restrictive now and doesn't enable adding facet channels, which are a bit different from other encoding channels. There are also some bugs with respect to the type shortcuts (using "N" for "nominal").

Yes vl_facet_row(field = "group", type = "nominal") would be the alternative to vl_encode(row=list(field = "group", type = "nominal"))... but I think it should be possible to also enable vl_encode to accept the row and and column arguments too. The reason for that regression is that now vl_encode thinks it can only accept 'real' encoding properties instead of the facet macros.

Re tooltip, need to look into that...

Re validation issues, I want to make it optional (#22 ), partially because the code is slower if you validate at every step and it can add up for complicated charts. Re some of the issues, I think some of them are due to the type shortcuts, others are probably worth investigating...