When plotting the boxplot, I wonder how exactly does plotly.js determine the tick positions when the tickmode is set to be “auto”?
For example, in this plot (https://codepen.io/anon/pen/rvLRNX ), the number of ticks on the yaxis is 5, while in this case (https://codepen.io/anon/pen/MGexYR ), the number is 7.
It’s a pretty complex algorithm. I won’t attempt to put it into words. But if you’re interested, the source code is here:
// autoTicks: calculate best guess at pleasant ticks for this axis
// inputs:
// ax - an axis object
// roughDTick - rough tick spacing (to be turned into a nice round number)
// outputs (into ax):
// tick0: starting point for ticks (not necessarily on the graph)
// usually 0 for numeric (=10^0=1 for log) or jan 1, 2000 for dates
// dtick: the actual, nice round tick spacing, usually a little larger than roughDTick
// if the ticks are spaced linearly (linear scale, categories,
// log with only full powers, date ticks < month),
// this will just be a number
// months: M#
// years: M# where # is 12*number of years
// log with linear ticks: L# where # is the linear tick spacing
// log showing powers plus some intermediates:
// D1 shows all digits, D2 shows 2 and 5
axes.autoTicks = function(ax, roughDTick) {
var base;
function getBase(v) {
This file has been truncated. show original
Thank you for the reply!
I wonder if there a way to extract the y-axis labels after the plot is drawn?
In this example of boxplot drawn by javascript plotly (https://codepen.io/anon/pen/deOdeB ), I wonder if there a way to extract the y-axis labels from the plot. The expected outcome is [0, 0.2, 0.4, 0.6, 0.8, 1]
.