-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Custom marker shapes #330
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
Comments
That's correct. The symbol definitions aren't exposed to users. Adding or modifying these definitions must be done before the bundling step.
Here's my hacky solution: master...etpinard:custom-symbol-list then |
Ok so it's impossible then. This is really too bad. Is there any other way to override the drawing of scatter markers? At some level they're just functions... when the markers are drawn, I want to use a function which was defined after the plotly.js has been loaded.
Thanks, but this is not what I want... I want to be able to specify the shape on the fly, not during the build process. |
Can I ask why you would want to do that? |
FWIW, if I need a "custom shape" in our R client, I usually draw a polygon |
@cpsievert I don't follow exactly what you're doing... how do you specify the custom shape in your polygon? Also if I understand your code, you lose the ability to have different fills/colors/sizes? (or is that just a bug with the stroke/border?) Would it be hard to extend my earlier example to do this? scatter(rand(100), zcolor=1:100, marker = (shape, rand(10:50,100), 0.4, stroke(0))) Thanks for the help! |
with x/y values
Not necessarily, if I need two polygons with different fill, for instance, I draw two traces. Most of these plots are made with polygons -- https://beta.rstudioconnect.com/cpsievert/ggplotlyDashBoard/ |
+1 for custom symbol paths (or even images as per #197, but polygons would suffice). I don't get why the |
+1 for this, and ideally to use local pngs as the marker symbol. |
I think this would be a good feature (and something I could use just now, as I would like a rectangular marker, which is not available in the standard list...) |
This would be very helpful to me. Higher precision markers like the thinner "+" and "x" available in matplotlib make it easier for me to see what's going on in the data, and I've also had the need to use my own png or svg markers on web plots in the past. It'd be great to be able to "bring your own" marker in some way. |
Thinner + and x exist already (with thickness set just by I won't reopen the issue just yet without some more discussion, but I could imagine extending the system we have for path shapes - where we let you specify path strings with data values in them and we extract the numbers from the strings and rescale them to the specific marker. My only concern doing this is performance, shapes aren't really expected to be repeated thousands of times. That said, it's possible we could also improve the performance of regular pre-defined markers by reusing the same path each time, scaling with a transform, and using |
Those cross-thin-open markers are great, thanks for the response! I had
found the scatter > marker > symbol
<https://plot.ly/python/reference/#scatter-marker-symbol> reference, but
basically balked at the wall of text, tried a few options, and gave up. Is
there a way you could make the feature (and the excellent example you
showed) more accessible somewhere?
As for more custom symbols, you're the implementation expert, but as a
naive user it seems most intuitive and useful to throw a whole svg or a png
into `marker.symbol`. It would probably be limited to specific charts and
it would be reasonable for it to come with a caveat that performance might
not be great with large data sets.
…On Mon, Jun 25, 2018 at 11:33 AM alexcjohnson ***@***.***> wrote:
Thinner + and x exist already (with thickness set just by
marker.line.width):
https://rreusser.github.io/plotly-mock-viewer/#marker_symbols
[image: screen shot 2018-06-25 at 2 02 54 pm]
<https://user-images.githubusercontent.com/2678795/41867369-fc755b22-7880-11e8-8d2e-c2e19ff3ef88.png>
I won't reopen the issue just yet without some more discussion, but I
could imagine extending the system we have for path shapes - where we let
you specify path strings with data values in them and we extract the
numbers from the strings and rescale them to the specific marker. My only
concern doing this is performance, shapes aren't really expected to be
repeated thousands of times.
That said, it's possible we could also improve the performance of regular
pre-defined markers by reusing the same path each time, scaling with a
transform, and using vector-effect: non-scaling-stroke. If we did that,
custom marker paths would be almost trivial to implement.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#330 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADL601UnzcsJqmpRLuFfp-i3Gb2nb15bks5uASz1gaJpZM4HwYYl>
.
|
I would like the ability to create custom marker shapes dynamically (i.e. I don't know the shape beforehand). I don't want the "shapes" that are defined in the layout... I want to take advantage of the mechanisms of traces (scatter markers).
I thought it would be as easy as adding to or overwriting an entry here: https://github.com/plotly/plotly.js/blob/master/src/components/drawing/symbol_defs.js. However, I can't figure out how to access this object from client javascript.
If this is currently possible to do (a hack is fine) please let me know and maybe supply a simple example. If it's not possible, can you give me options of how this can be implemented? Thanks.
The text was updated successfully, but these errors were encountered: