Skip to content

Have nticks be respected when tickmode='array' #1812

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
talgalili opened this issue Jun 23, 2017 · 15 comments
Closed

Have nticks be respected when tickmode='array' #1812

talgalili opened this issue Jun 23, 2017 · 15 comments
Labels
feature something new

Comments

@talgalili
Copy link

Examples for how it should work (using R's plotly package)

Works fine:

library(plotly)
p <- plot_ly(
    width = 800,
    height = 500
  ) %>% layout(
    title = "fixed-ratio axes",
    xaxis = list(
      nticks = 10,
      domain = c(0, 0.45)
    ) )
p

image

Does not yet work:

library(plotly)
p <- plot_ly(
    width = 800,
    height = 500
  ) %>% layout(
    title = "fixed-ratio axes",
    xaxis = list(
      nticks = 10,
      domain = c(0, 0.45),
	tickmode='array'
    ) )
p

image

This feature is specifically important for creating cluster-heatmaps that allow more refined control over the number of ticks (see here)

@etpinard
Copy link
Contributor

That's the intended behavior. Setting tickmode: 'array' turns off the auto-ticks (where nticks is used).

When you say

Does not yet work:

What do you mean? What is the expected behavior in your mind?

@alanocallaghan
Copy link

I think the desired output in this instance is for the user to be able to manually specify tick values and labels, but also apply the "auto" tick generating method.

For example, here I am creating a heatmap with categorical labels and automatic ticks by specifying the x co-ordinates, and tick generation works nicely:
https://codepen.io/alanoc/pen/yXPgEp

However, in some cases it is desirable to map categorical scales to numerical scales, in order to present them side-by-side with other plots (and, more importantly, aligned), while maintaining meaningful categorical ticks. For example, heatmaps are commonly presented with dendrograms aligned to rows and columns, in order to show relationships between samples (eg, https://i.stack.imgur.com/1qTWn.png).
To accomplish this, I would commonly specify a numeric axis and tick values, but character tick text. In this case, label overplotting is very common:
https://codepen.io/alanoc/pen/WOXRLE

Perhaps tickvals and ticktext are not the right parameters to be used in this instance, as they do imply the values actually used for ticks; however I do think it would be useful to have this level of control.

@JuankS92
Copy link

JuankS92 commented Jul 21, 2017

This is a problem we are facing right now. I want to be able to add ellipsis to the labels in the X axis, so we use ticktext and tickvals to set the values on the labels. As you can see in the example above by @alanocallaghan the number of ticks might be a huge amount of data so in those cases, the auto setting is disabled and the labels become unreadable. Perhaps we should be able to handle the number of ticks shown on the graph or let the auto handling for the number of ticks to be available instead of making them mutually exclusive.

@etpinard
Copy link
Contributor

Merging with #1812

@alanocallaghan
Copy link

@etpinard this issue is #1812

@etpinard
Copy link
Contributor

Merged with #1946

@alexcjohnson
Copy link
Collaborator

As discussed in #1965 (comment) I think this is a different issue, and might be solved by something like #303 which we could generalize for the tickmode = 'array' case like "iterate through the array and display each tick iff it's more than n pixels away from all the others we've already drawn"

@alexcjohnson alexcjohnson reopened this Oct 10, 2017
@alanocallaghan
Copy link

I think that's right @alexcjohnson, thanks for the clarification

@talgalili
Copy link
Author

Thanks @alexcjohnson for the clarification and for re-opening this.
I'm looking forward for #303 to be resolved, so that you or others could try to leverage it to solve this issue.

@talgalili
Copy link
Author

Hello @etpinard (and @alexcjohnson),
I see that you wrote in #1946 that it would provide a solution to this issue. I see it is now closed thanks to #1965. Does this mean that this issue is now also resolved? If not, what else should be done in order to address it?

Thanks.

@alexcjohnson
Copy link
Collaborator

@talgalili this is separate from #1946 and #1965, as mentioned in #1812 (comment)

We need to resurrect #303 and incorporate this into it. Unfortunately Plotly folks are extremely busy for the next few months so I don't see this getting addressed in the near future without a community volunteer to spearhead it.

@talgalili
Copy link
Author

Thanks @alexcjohnson - I've added a comment on #303 and I hope someone could take it upon themselves to add this.

@jackparmer
Copy link
Contributor

This issue has been tagged with NEEDS SPON$OR

A community PR for this feature would certainly be welcome, but our experience is deeper features like this are difficult to complete without the Plotly maintainers leading the effort.

Sponsorship range: $5k-$10k

What Sponsorship includes:

  • Completion of this feature to the Sponsor's satisfaction, in a manner coherent with the rest of the Plotly.js library and API
  • Tests for this feature
  • Long-term support (continued support of this feature in the latest version of Plotly.js)
  • Documentation at plotly.com/javascript
  • Possibility of integrating this feature with Plotly Graphing Libraries (Python, R, F#, Julia, MATLAB, etc)
  • Possibility of integrating this feature with Dash
  • Feature announcement on community.plotly.com with shout out to Sponsor (or can remain anonymous)
  • Gratification of advancing the world's most downloaded, interactive scientific graphing libraries (>50M downloads across supported languages)

Please include the link to this issue when contacting us to discuss.

@gvwilson
Copy link
Contributor

Hi - this issue has been sitting for a while, so as part of our effort to tidy up our public repositories I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our stack. Cheers - @gvwilson

@talgalili
Copy link
Author

Hi @gvwilson
This problem still hinders/impacts heatmaply.
But given that this wasn't addressed in 7 years now, I don't see a point in asking for it again.
Users would just have to live with the reduced performance due to this issue not getting addressed.

Thanks for your other work.

Tal.

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

No branches or pull requests

7 participants