Have nticks be respected when tickmode='array'
See original GitHub issueExamples 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)
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Formatting ticks in JavaScript - Plotly
Layout Attributes with respect to Formatting Ticks ... Set the tick mode for the axis "auto" or "linear" or "array" */ tickmode: 'auto', ......
Read more >Skip overlapping tick labels in Plotly Javascript - Stack Overflow
Usually I solve this by rotating the labels by some 35-45 degrees. That way they are all there and still readable.
Read more >Yaxis - XPlot - FsLab
CompiledName: get__isSubplotObj ... Sets the step in-between ticks on this axis Use with tick0 . ... Only has an effect if tickmode is...
Read more >plotly.graph_objs.indicator.gauge - Anvil Works
tickvals - Sets the values at which ticks on this axis appear. Only has an effect if `tickmode` is set to *array*. Used...
Read more >ColorBar (Plotly.NET)
TickVals : seq<'c>. Sets the values at which ticks on this axis appear. Only has an effect if `tickmode` is set to "array"....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
andticktext
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.Merged with https://github.com/plotly/plotly.js/issues/1946