Skip to content

small domain does not display correctly. #3403

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

Closed
slfan2013 opened this issue Jan 5, 2019 · 6 comments
Closed

small domain does not display correctly. #3403

slfan2013 opened this issue Jan 5, 2019 · 6 comments
Assignees
Labels
bug something broken

Comments

@slfan2013
Copy link

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’t 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?

@alexcjohnson
Copy link
Collaborator

That's because of the 0.01 on this line:

if(domain[0] > domain[1] - 0.01) containerOut.domain = dfltDomain;

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?

@slfan2013
Copy link
Author

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.

@slfan2013
Copy link
Author

And I cannot find the 0.01 buffer in the CDN?

@alexcjohnson
Copy link
Collaborator

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!

@alexcjohnson
Copy link
Collaborator

I’ll leave the issue open, as it probably would be good to tighten up this limit.

@archmoj
Copy link
Contributor

archmoj commented Jan 6, 2019

@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"

@archmoj archmoj self-assigned this Jan 6, 2019
@archmoj archmoj added the bug something broken label Jan 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

No branches or pull requests

3 participants