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

symbol #652

Merged
merged 10 commits into from
Jan 7, 2022
Merged

symbol #652

merged 10 commits into from
Jan 7, 2022

Conversation

mbostock
Copy link
Member

@mbostock mbostock commented Jan 5, 2022

TODO

  • add a test for categorical symbol encoding
  • optimize rendering for the common case of circles
  • optimize rendering for the common case of no rotation
  • allow a symbol scale’s domain to be specified as symbol names
  • a symbol legend? not very useful without a legend…
  • use better symbols preattentive symbols d3/d3-shape#189
  • add documentation

Fixes #41.

@mbostock mbostock requested a review from Fil January 5, 2022 18:23
@mbostock mbostock force-pushed the mbostock/symbol branch 4 times, most recently from c1005c1 to ea08e4d Compare January 5, 2022 19:43
@Fil
Copy link
Contributor

Fil commented Jan 5, 2022

I like where this is going. We can do the legend (a bit) later; I need to revisit the radius legend also…

@mbostock
Copy link
Member Author

mbostock commented Jan 5, 2022

Implementing a symbol legend was surprisingly easy! Hooray. It would be nice if we could combine the legends for the symbol and color scales into one, in the case where they’re used for the same encoding, but I’m not sure yet how we’d determine that and at any rate it feels like a future problem.

Screen Shot 2022-01-05 at 12 42 21 PM

@mbostock
Copy link
Member Author

mbostock commented Jan 5, 2022

Screen Shot 2022-01-05 at 1 34 12 PM

@Fil
Copy link
Contributor

Fil commented Jan 5, 2022

wow!

@mbostock
Copy link
Member Author

mbostock commented Jan 5, 2022

The adoption of new (preattentive) symbols is probably a blocker for this PR, unless we can come up with good and non-conflicting names for those symbols. I wouldn’t want people to have to say symbol: "diamond2" to get the preferred diamond.

@Fil
Copy link
Contributor

Fil commented Jan 6, 2022

Re: symbols names, just like you can have text: "abc" and various fonts, we could imagine that symbol: "diamond" looks up the diamond symbol in the current symbolFamily / symbolSet. (In other words I don't believe there can be a flat namespace for symbols, see the unicode/emoji mess.)

This approach would also allow "styling", by switching to a different symbol set. It would be cool to systematically have the symbols aliased as symbol1 symbol2 symbol3, on top of their descriptive names.

@mbostock
Copy link
Member Author

mbostock commented Jan 6, 2022

I would prefer symbol names that are context-free so that it’s unambiguous and you can mix and match symbols from different sets. Also, I’d generally like Plot to use D3’s names simply to avoid introducing confusion, and we’ll need to pick unique names for D3 (in d3/d3-shape#189, currently: asterisk, diamond2, plus, square2, triangle2, and x).

It’ll also be possible to say symbol: {range: d3.symbolsFill} or symbol: {range: d3.symbolsStroke} to choose a different symbol set (the set of fillable symbols and strokeable symbols, respectively). And it’d be great if Plot could chose the right one based on whether the symbols will be filled or stroked—probably by allowing marks to specify a default range for a particular scale, similar to how they can specify a default scale type.

I can start prototyping this here but it’d probably be easier to land and release the new d3-shape first, once you review.

@mbostock mbostock merged commit 6ff1538 into mbostock/vector Jan 7, 2022
@mbostock mbostock deleted the mbostock/symbol branch January 7, 2022 18:44
mbostock added a commit that referenced this pull request Jan 7, 2022
* vector

* default anchor to middle

* remove blank lines

* further code golf

* symbol (#652)

* symbol

* optimize rendering

* maybeSymbolChannel

* move default symbol to Plot.Dot

* symbol legend

* symbol legend paint options

* color+symbol legend

* automatic symbol hints

* fix for orthogonal color and symbol

* preattentive symbols

* update README

* remove vectorX, vectorY

* update README

* length scale

* Update README

* limit max default vector length to 60px

* fix y-only symbols

* Update README.md

Co-authored-by: Philippe Rivière <fil@rezo.net>

* Update README

* update README

Co-authored-by: Philippe Rivière <fil@rezo.net>
@mbostock mbostock mentioned this pull request Jan 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants