Skip to content

Commit 94ff74d

Browse files
committed
disallow automatic D2 minor when major is > 1 order of mag
looks confusing to have minor ticks 2,5,10,20,50, so drop to just the orders of magnitude. D1 is fine though, if you ask for that many minor ticks!
1 parent 64a211b commit 94ff74d

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

src/plots/cartesian/axes.js

+4
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,10 @@ axes.prepMinorTicks = function(mockAx, ax, opts) {
621621
} else {
622622
mockAx.dtick = 'D1';
623623
}
624+
} else if(mockAx.dtick === 'D2' && +ax.dtick > 1) {
625+
// the D2 log axis tick spacing is confusing for unlabeled minor ticks if
626+
// the major dtick is more than one order of magnitude.
627+
mockAx.dtick = 1;
624628
}
625629
}
626630
// put back the original range, to use to find the full set of minor ticks

test/jasmine/tests/axes_test.js

+23-2
Original file line numberDiff line numberDiff line change
@@ -6628,6 +6628,27 @@ describe('Test axes', function() {
66286628
});
66296629

66306630
it('log auto - case 2', function(done) {
6631+
Plotly.newPlot(gd, {
6632+
data: [{
6633+
x: [1, 10e10]
6634+
}],
6635+
layout: {
6636+
width: 1000,
6637+
xaxis: {
6638+
type: 'log',
6639+
minor: {
6640+
showgrid: true
6641+
}
6642+
}
6643+
}
6644+
})
6645+
.then(function() {
6646+
_assert([ 1, 3, 5, 7, 9, 11 ]);
6647+
})
6648+
.then(done, done.fail);
6649+
});
6650+
6651+
it('log auto - case 3', function(done) {
66316652
Plotly.newPlot(gd, {
66326653
data: [{
66336654
x: [1, 10e3]
@@ -6648,7 +6669,7 @@ describe('Test axes', function() {
66486669
.then(done, done.fail);
66496670
});
66506671

6651-
it('log auto - case 3', function(done) {
6672+
it('log auto - case 4', function(done) {
66526673
Plotly.newPlot(gd, {
66536674
data: [{
66546675
x: [1, 10]
@@ -6669,7 +6690,7 @@ describe('Test axes', function() {
66696690
.then(done, done.fail);
66706691
});
66716692

6672-
it('log auto - case 4', function(done) {
6693+
it('log auto - case 5', function(done) {
66736694
Plotly.newPlot(gd, {
66746695
data: [{
66756696
x: [1, 2]

0 commit comments

Comments
 (0)