question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Have nticks be respected when tickmode='array'

See original GitHub issue

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)

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

6reactions
Alanocallaghancommented, Jun 27, 2017

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.

1reaction
etpinardcommented, Aug 11, 2017
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found