Plotly.js: small domain does not display correctly.

Created on 5 Jan 2019  路  6Comments  路  Source: plotly/plotly.js

In this codepen, the first attempt on Plotly.newPlot is not working.

I have two Y-axes. The bottom has a domain of [0,0.5], while the second has the plot_layout.yaxis2.domain = [0.945, 0.95]. However, the second Y-axis will overlap the whole plot. I expected it only covers the top 94.5% to 95%. I don鈥檛 know why this does not work. If I simply change the domain to [0.94, 0.95] covering top 94% to 95%, it suddenly worked. Why does this happen?

bug

All 6 comments

That's because of the 0.01 on this line:

https://github.com/plotly/plotly.js/blob/364cdec83e862e076ab02400b814ed9566777351/src/plots/cartesian/position_defaults.js#L75

which is mainly there to prevent zero- or negative-size domains, but we gave it a small buffer to cover "almost zero" or rounding errors. We can certainly decrease that buffer to 0.0001 or something, but I'm curious what use you have for such a small axis?

Thank you for the information!

Why do you want to avoid "almost zero" values?

The reason I need such a small domain is that I am trying to create a heatmap similar with shown in this paper. It is a multiple axis with heatmap, dendrogram and also annotation (which is also a type of heatmap). My heatmap will has height of 3000 px and my annotation would be fixed at 10 px high. So 10/3000 is a very small number, which need a narrow domain.

And I cannot find the 0.01 buffer in the CDN?

Why do you want to avoid "almost zero" values?

I think we wanted to avoid errors if we round some size to zero and end up making invalid svg elements. Perhaps we should take the height or width into account, and refuse any domain smaller than 1px.

And I cannot find the 0.01 buffer in the CDN?

It's going to be hard to find something like that in minified code, but since you're seeing this effect I'm quite sure it's there somewhere!

I鈥檒l leave the issue open, as it probably would be good to tighten up this limit.

@slfan2013 Just opened a pull request to possibly help your research porject. In the meantime you may want to try the source used in this demo or one of the two on the lines below:
"https://22828-45646037-gh.circle-artifacts.com/0/plotly.js"
"https://22828-45646037-gh.circle-artifacts.com/0/plotly.min.js"

Was this page helpful?
0 / 5 - 0 ratings