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

More symbols for gl2d and gl3d plots #1550

Closed
wants to merge 8 commits into from
Closed

Conversation

etpinard
Copy link
Contributor

@etpinard etpinard commented Apr 3, 2017

This PR supersedes @destradafilm's #1482

@etpinard etpinard added this to the v1.26.0 milestone Apr 3, 2017
@etpinard etpinard mentioned this pull request Apr 3, 2017
"y": [1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5],
"mode": "markers",
"text": [
"marker number: 0<br>marker string: 'circle'",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexcjohnson Turns out we didn't have a mock testing all our marker symbols.

I dug out https://github.com/plotly/streambed/pull/358 and plotly/documentation#16 and made this one here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Can you include just a few examples of 1xx (-open), 2xx (-dot) and 3xx (-open-dot) in this mock? It should be able to support just one more row 😉

And then we'll be able to see how this compares with the gl implementation, where I'm pretty sure colors are handled differently in the -open case than they currently are for svg, ie we would never have a double line like gl2d currently has.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 083b00a

"y": 1,
"xref": "paper",
"yref": "paper",
"text": "Add 100 (or '-open') to marker number (or string) to remove the fill color,<br>Add 200 (or '-dot') to marker number (or string) to add a dot in the middle,<br>Add 300 (or '-open-dot', 'dot-open') to marker number (or string) for both.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I presume (-open)?-dot is not supported in gl? That's fine, but we should be clear about this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See b4db0ef

'circle-x': '⊗',
'square-cross': '⊞',
'square-x': '⊠',
'asterisk': '✱'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two other tweaks this is going to need before it can really match how the svg symbols behave:

  • all the symbols should have roughly the same scale. You can see from the svg test image that this is a little bit subjective, for example the side of the square is the same as the diameter of the circle, but the outer width of X and + are a little bigger - basically I tweaked each one until put on a plot next to the other I thought they all looked "about the same size"
  • the symbol should be placed with its centroid at the data location, not the center of the bounding rect. For most of the symbols these are the same, but for the triangles they are not (and I guess also for the pentagons and 5-sided stars, to a lesser extent).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically this is going to require passing symbol-dependent offsets and scales to the relevant gl-vis modules. @destradafilm not sure if you want to take a crack at this, I'm afraid it'll be a little bit tedious and @etpinard and I may not be able to get to it for a while.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexcjohnson I'd like to take a crack at it, but it will take a while for me since I've got a full plate at the moment, as well.

@etpinard
Copy link
Contributor Author

etpinard commented Apr 7, 2017

fyi @dfcreative

@etpinard
Copy link
Contributor Author

etpinard commented Jun 6, 2017

@dfcreative you're ok taking over this one?

@dy
Copy link
Contributor

dy commented Jun 6, 2017

@etpinard yes. To clarify: it is expected to just extend various symbols, or to consider @alexcjohnson's suggestions on optical alignment? Also some OS don't have symbols declared, eg. for me it looks like:
image

As a workaround, it is possible to replace bad symbols with ones from http://www.copypastecharacter.com/. But manual alignment is unsustainable in this case because symbol size/glyph vary across different OS.

Good solution − come up with optically balanced marker font (with technique similar to wavefont) and load is via add-font or alike.

@etpinard
Copy link
Contributor Author

etpinard commented Jun 7, 2017

@dfcreative

To clarify: it is expected to just extend various symbols, or to consider @alexcjohnson's suggestions on optical alignment?

Yes, make sure @alexcjohnson 's #1550 (comment) is addressed.

Also some OS don't have symbols declared,

Do you have an idea of which symbols are available on each of the major OS? (Plotly has a https://www.browserstack.com if you need one). We don't have to include all of them. If we can add the triangles and a few star-like symbols that work in most OS in this PR, I'd be very happy.

Good solution − come up with optically balanced marker font (with technique similar to wavefont) and load is via add-font or alike.

That's sounds like a better long-term solution. I would prefer waiting for scattergl v2 though.

@dy
Copy link
Contributor

dy commented Jun 9, 2017

Ok just finished a tool for normalizing markers size/alignment, following @alexcjohnson suggestions. We can use that in order to look markers consistent across devices/OS, because right now glyphs are very different.

Introduced that into font-atlas-sdf.
Preparing a patch along with handpicked subset of crossplatform symbols to close this issue.

@etpinard
Copy link
Contributor Author

etpinard commented Jun 9, 2017

Introduced that into font-atlas-sdf.
Preparing a patch along with handpicked subset of crossplatform symbols to close this issue.

Excellent.

@dy
Copy link
Contributor

dy commented Jun 9, 2017

Branch https://github.com/dfcreative/plotly.js/tree/pr-1482-gl-symbols includes merged master and extends symbols to be cross-platform.

gl-vis/gl-scatter2d-sdf#4 normalizes markers alignment/size. The result is more or less consistent across platforms:

image

Exact size of points can be adjusted here https://github.com/gl-vis/gl-scatter2d-sdf/blob/fit-symbols/scatter.js#L51. That can break some tests not significantly.

@etpinard etpinard mentioned this pull request Jun 12, 2017
1 task
@etpinard
Copy link
Contributor Author

Superseded by #1781

@etpinard etpinard closed this Jun 12, 2017
@etpinard etpinard deleted the pr-1482-gl-symbols branch June 12, 2017 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants