Repository navigation
Option to prevent symbol truncation at ternary axis boundaries #1385
Description
Activity
Thanks for pointing this out.
My pleasure! I appreciate your taking the time to consider the issue.
What do you think about the idea of having a boolean attribute to provide the desired behavior? The default value could be true to be consistent with the current implementation but false would produce a plot analogous to the "desired display" example above.
In most cases my guess is that you would either want no truncation of markers at the axes at all on the plot or to have the plot behave as it does now so this attribute could be defined at the top level of layout (markeraxistrunctate?). I suppose, however, that having the ability to define this attribute on the axis (markertruncate?) or the trace marker (axistruncate?) levels would allow for finer-grained control at the expense of a more verbose configuration.
- changed the title
[-]Option to prevent symbol truncation at axis boundaries[/-][+]Option to prevent symbol truncation at ternary axis boundaries [/+]on Apr 10, 2017 Hi Étienne. Thanks for the question. The marker points near the axis boundaries should go on top of the axis line and tick labels. My rationale is that this seems to be more consistent with the objective of ensuring that they have visual weights that are equivalent to their counterparts near the center of the plot region.
Reacted by etpinard, Adam Kulidjian and Alex JohnsonI've made some solid progress on this ticket this week. You can track my WIP branch here:
https://github.com/plotly/plotly.js/compare/cliponaxis-false
At this stage,
- I named the attribute
cliponaxis. This attribute will be available fromscatterandscatterternarytrace and eventually forscattergeoas well. - By default,
cliponaxisis set totrue(the current behavior) - When turned on, markers, elements won't be clipped (new behavior)
- I'm thinking that also text and errorbars could benefit from
cliponaxis: false
Quick question: how should we determine if a non-clipped marker is visible or not? Intuitively, markers that have
xor/andystrictly beyond the set axis range should be removed. But, should we include the marker size in this calculation? That is,- Should all markers that touch the axis bounds be visible?
- Or, should all markers that are centered on the axis bounds be visible?
- I named the attribute
Great to see that you've made such good progress Étienne! The
cliponaxisattribute sounds perfect and I agree that it would be great if it also applied to text and errorbars.Regarding your question, if a marker point has a value that puts it outside of the axis range (i.e., its center is outside of the plot range) it should be removed irrespective of the symbol size. As you say, points that sit exactly on an axis, however, should be visible.
Regarding your question, if a marker point has a value that puts it outside of the axis range (i.e., its center is outside of the plot range) it should be removed irrespective of the symbol size. As you say, points that sit exactly on an axis, however, should be visible.
Thanks very much for the prompt response 👍
After some thoughts, maybe implementing
cliponaxis: falsefor error bars isn't such a great idea.Error bars positions are set in data coordinates unlike marker symbols and text size (which are set in pixel coordinates).
Furthermore, in matplotlib's
clip_on=Falseoption undoes marker points axis clips, but still clips error bars - see https://gist.github.com/etpinard/9167c1c69144e318ca2aa39539ec5091@etpinard sorry to revive the old ticket but is it possible to also support this in scattergl?
Currently if i switch to scatter it works but not in scattergl.Old indeed - feel free to open a new issue if you want to continue the discussion, but my hunch is this would be pretty hard in scattergl, as the rectangular viewport is baked in at a fairly low level


I have scoured the documentation but have been unable to find a way to prevent symbols from being truncated by axis boundaries. While you can avoid the problem by extending the boundaries beyond what you would normally use for the 'scatter' plot type (to slightly below zero for instance for cases where zero is the minimum data value), this is not a possibility with the 'scatterternary' type, at least for cases where points lie on an axis or apex.
To see the impact of the symbol truncation consider the plot below left where points at the apices are almost invisible and those in the middle of the axes also are quite small. This display is problematic because the center point has much greater visual heft compared to the remaining points, particularly compared to those on the apices. The preferred plotting approach is depicted on the right where each point has an equal visual weight irrespective of its position on the plot.