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

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

This feature is specifically important for creating cluster-heatmaps that allow more refined control over the number of ticks (see here)
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?
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.
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.
Merging with https://github.com/plotly/plotly.js/issues/1812
@etpinard this issue is #1812
Merged with https://github.com/plotly/plotly.js/issues/1946
As discussed in https://github.com/plotly/plotly.js/pull/1965#issuecomment-335346105 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"
I think that's right @alexcjohnson, thanks for the clarification
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.
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.
@talgalili this is separate from #1946 and #1965, as mentioned in https://github.com/plotly/plotly.js/issues/1812#issuecomment-335348104
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.
Thanks @alexcjohnson - I've added a comment on #303 and I hope someone could take it upon themselves to add this.
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:
Please include the link to this issue when contacting us to discuss.
Most helpful comment
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
tickvalsandticktextare 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.