Skip to content

Commit 9a0cdc4

Browse files
committed
Merge branch 'master' into ekl-my-tien-label-spacing
2 parents 7994f54 + bf6909b commit 9a0cdc4

25 files changed

+202
-22
lines changed

.circleci/config.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,12 @@ jobs:
217217
make-baselines-virtual-webgl:
218218
parallelism: 8
219219
docker:
220-
- image: circleci/python:3.8.9
220+
- image: cimg/python:3.12.11
221221
working_directory: ~/plotly.js
222222
steps:
223223
- attach_workspace:
224224
at: ~/
225+
- run: sudo apt-get update
225226
- run:
226227
name: Install kaleido, plotly.io and required fonts
227228
command: .circleci/env_image.sh
@@ -235,11 +236,12 @@ jobs:
235236

236237
make-baselines-mathjax3:
237238
docker:
238-
- image: circleci/python:3.8.9
239+
- image: cimg/python:3.12.11
239240
working_directory: ~/plotly.js
240241
steps:
241242
- attach_workspace:
242243
at: ~/
244+
- run: sudo apt-get update
243245
- run:
244246
name: Install kaleido, plotly.io and required fonts
245247
command: .circleci/env_image.sh
@@ -254,11 +256,12 @@ jobs:
254256
make-baselines:
255257
parallelism: 12
256258
docker:
257-
- image: circleci/python:3.8.9
259+
- image: cimg/python:3.12.11
258260
working_directory: ~/plotly.js
259261
steps:
260262
- attach_workspace:
261263
at: ~/
264+
- run: sudo apt-get update
262265
- run:
263266
name: Install kaleido, plotly.io and required fonts
264267
command: .circleci/env_image.sh
@@ -273,11 +276,12 @@ jobs:
273276
make-baselines-b64:
274277
parallelism: 12
275278
docker:
276-
- image: circleci/python:3.8.9
279+
- image: cimg/python:3.12.11
277280
working_directory: ~/plotly.js
278281
steps:
279282
- attach_workspace:
280283
at: ~/
284+
- run: sudo apt-get update
281285
- run:
282286
name: Install kaleido, plotly.io and required fonts
283287
command: .circleci/env_image.sh
@@ -347,11 +351,12 @@ jobs:
347351

348352
make-exports:
349353
docker:
350-
- image: circleci/python:3.8.9
354+
- image: cimg/python:3.12.11
351355
working_directory: ~/plotly.js
352356
steps:
353357
- attach_workspace:
354358
at: ~/
359+
- run: sudo apt-get update
355360
- run:
356361
name: Install kaleido, plotly.io and required fonts
357362
command: .circleci/env_image.sh
@@ -362,7 +367,7 @@ jobs:
362367
sudo apt-get install poppler-utils
363368
- run:
364369
name: Create svg, jpg, jpeg, webp, pdf and eps files
365-
command: python3 test/image/make_exports.py
370+
command: sudo python3 test/image/make_exports.py
366371
- persist_to_workspace:
367372
root: ~/
368373
paths:
@@ -488,7 +493,7 @@ jobs:
488493
- store_artifacts:
489494
path: stackgl_modules/index.js
490495
destination: stackgl_modules/index.js
491-
496+
492497
test-topojson-build:
493498
docker:
494499
- image: cimg/node:18.20.4

.circleci/env_image.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,20 @@
22
set -e
33
# install required fonts
44
sudo apt-get install fonts-liberation2 fonts-open-sans fonts-noto-cjk fonts-noto-color-emoji
5+
6+
# install pip
7+
sudo curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
8+
sudo python3 get-pip.py
9+
10+
# install additional fonts
11+
sudo python3 -m pip install requests
512
sudo python3 .circleci/download_google_fonts.py
613
sudo cp -r .circleci/fonts/ /usr/share/
14+
sudo apt install fontconfig
715
sudo fc-cache -f
16+
817
# install kaleido & plotly
9-
sudo python3 -m pip install kaleido==0.2.1 plotly==5.5.0 --progress-bar off
18+
sudo python3 -m pip install kaleido==0.2.1 plotly==6.2.0 --progress-bar off
19+
1020
# install numpy i.e. to convert arrays to typed arrays
1121
sudo python3 -m pip install numpy==1.24.2

.circleci/test.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,24 +97,24 @@ case $1 in
9797
find $ROOT/test/image/mocks/gl* -type f -printf "%f\n"; \
9898
find $ROOT/test/image/mocks/map* -type f -printf "%f\n"; \
9999
} | sed 's/\.json$//1' | circleci tests split)
100-
python3 test/image/make_baseline.py virtual-webgl $SUITE || EXIT_STATE=$?
100+
sudo python3 test/image/make_baseline.py virtual-webgl $SUITE || EXIT_STATE=$?
101101
exit $EXIT_STATE
102102
;;
103103

104104
make-baselines-mathjax3)
105-
python3 test/image/make_baseline.py mathjax3 legend_mathjax_title_and_items mathjax parcats_grid_subplots table_latex_multitrace_scatter table_plain_birds table_wrapped_birds ternary-mathjax ternary-mathjax-title-place-subtitle || EXIT_STATE=$?
105+
sudo python3 test/image/make_baseline.py mathjax3 legend_mathjax_title_and_items mathjax parcats_grid_subplots table_latex_multitrace_scatter table_plain_birds table_wrapped_birds ternary-mathjax ternary-mathjax-title-place-subtitle || EXIT_STATE=$?
106106
exit $EXIT_STATE
107107
;;
108108

109109
make-baselines-b64)
110110
SUITE=$(find $ROOT/test/image/mocks/ -type f -printf "%f\n" | sed 's/\.json$//1' | circleci tests split)
111-
python3 test/image/make_baseline.py b64 $SUITE || EXIT_STATE=$?
111+
sudo python3 test/image/make_baseline.py b64 $SUITE || EXIT_STATE=$?
112112
exit $EXIT_STATE
113113
;;
114114

115115
make-baselines)
116116
SUITE=$(find $ROOT/test/image/mocks/ -type f -printf "%f\n" | sed 's/\.json$//1' | circleci tests split)
117-
python3 test/image/make_baseline.py $SUITE || EXIT_STATE=$?
117+
sudo python3 test/image/make_baseline.py $SUITE || EXIT_STATE=$?
118118
exit $EXIT_STATE
119119
;;
120120

draftlogs/7468_add.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Add `minorloglabels` to cartesian axes [#7468](https://github.com/plotly/plotly.js/pull/7468)

src/plots/cartesian/axes.js

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,26 +1899,41 @@ function formatLog(ax, out, hover, extraPrecision, hideexp) {
18991899

19001900
if(tickformat || (dtChar0 === 'L')) {
19011901
out.text = numFormat(Math.pow(10, x), ax, hideexp, extraPrecision);
1902-
} else if(isNumeric(dtick) || ((dtChar0 === 'D') && (Lib.mod(x + 0.01, 1) < 0.1))) {
1903-
var p = Math.round(x);
1902+
} else if(isNumeric(dtick) || ((dtChar0 === 'D') &&
1903+
(ax.minorloglabels === 'complete' || Lib.mod(x + 0.01, 1) < 0.1))) {
1904+
1905+
var isMinor;
1906+
if(ax.minorloglabels === 'complete' && !(Lib.mod(x + 0.01, 1) < 0.1)) {
1907+
isMinor = true;
1908+
out.fontSize *= 0.75;
1909+
}
1910+
1911+
var exponentialString = Math.pow(10, x).toExponential(0);
1912+
var parts = exponentialString.split('e');
1913+
1914+
var p = +parts[1];
19041915
var absP = Math.abs(p);
19051916
var exponentFormat = ax.exponentformat;
19061917
if(exponentFormat === 'power' || (isSIFormat(exponentFormat) && beyondSI(p))) {
1907-
if(p === 0) out.text = 1;
1908-
else if(p === 1) out.text = '10';
1909-
else out.text = '10<sup>' + (p > 1 ? '' : MINUS_SIGN) + absP + '</sup>';
1918+
out.text = parts[0];
1919+
if(absP > 0) out.text += 'x10';
1920+
if(out.text === '1x10') out.text = '10';
1921+
if(p !== 0 && p !== 1) out.text += '<sup>' + (p > 0 ? '' : MINUS_SIGN) + absP + '</sup>';
19101922

19111923
out.fontSize *= 1.25;
19121924
} else if((exponentFormat === 'e' || exponentFormat === 'E') && absP > 2) {
1913-
out.text = '1' + exponentFormat + (p > 0 ? '+' : MINUS_SIGN) + absP;
1925+
out.text = parts[0] + exponentFormat + (p > 0 ? '+' : MINUS_SIGN) + absP;
19141926
} else {
19151927
out.text = numFormat(Math.pow(10, x), ax, '', 'fakehover');
19161928
if(dtick === 'D1' && ax._id.charAt(0) === 'y') {
19171929
out.dy -= out.fontSize / 6;
19181930
}
19191931
}
19201932
} else if(dtChar0 === 'D') {
1921-
out.text = String(Math.round(Math.pow(10, Lib.mod(x, 1))));
1933+
out.text =
1934+
ax.minorloglabels === 'none' ? '' :
1935+
/* ax.minorloglabels === 'small digits' */ String(Math.round(Math.pow(10, Lib.mod(x, 1))));
1936+
19221937
out.fontSize *= 0.75;
19231938
} else throw 'unrecognized dtick ' + String(dtick);
19241939

@@ -3772,7 +3787,7 @@ axes.drawLabels = function(gd, ax, opts) {
37723787

37733788
var sel;
37743789
if(e.K === ZERO_PATH.K) {
3775-
var zerolineLayer = zerolineIsAbove ? mainPlotinfo.zerolinelayerAbove : mainPlotinfo.zerolinelayer;
3790+
var zerolineLayer = zerolineIsAbove ? mainPlotinfo.zerolinelayerAbove : mainPlotinfo.zerolinelayer;
37763791
sel = zerolineLayer.selectAll('.' + ax._id + 'zl');
37773792
} else if(e.K === MINORGRID_PATH.K) sel = mainPlotinfo.minorGridlayer.selectAll('.' + ax._id);
37783793
else if(e.K === GRID_PATH.K) sel = mainPlotinfo.gridlayer.selectAll('.' + ax._id);

src/plots/cartesian/layout_attributes.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,19 @@ module.exports = {
11361136
editType: 'ticks'
11371137
},
11381138

1139+
minorloglabels: {
1140+
valType: 'enumerated',
1141+
values: ['small digits', 'complete', 'none'],
1142+
dflt: 'small digits',
1143+
editType: 'calc',
1144+
description: [
1145+
'Determines how minor log labels are displayed.',
1146+
'If *small digits*, small digits i.e. 2 or 5 are displayed.',
1147+
'If *complete*, complete digits are displayed.',
1148+
'If *none*, no labels are displayed.',
1149+
].join(' ')
1150+
},
1151+
11391152
layer: {
11401153
valType: 'enumerated',
11411154
values: ['above traces', 'below traces'],

src/plots/cartesian/tick_label_defaults.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe
7070
coerce('separatethousands');
7171
}
7272
}
73+
74+
if(!options.noMinorloglabels && axType === 'log') {
75+
coerce('minorloglabels');
76+
}
7377
}
7478
};
7579

src/plots/gl3d/layout/axis_defaults.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) {
4242
data: options.data,
4343
showGrid: true,
4444
noAutotickangles: true,
45+
noMinorloglabels: true,
4546
noTicklabelindex: true,
4647
noTickson: true,
4748
noTicklabelmode: true,

src/plots/polar/layout_attributes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ var axisTickAttrs = overrideAll({
3636
ticklabelstep: axesAttrs.ticklabelstep,
3737
showticklabels: axesAttrs.showticklabels,
3838
labelalias: axesAttrs.labelalias,
39+
minorloglabels: axesAttrs.minorloglabels,
3940
showtickprefix: axesAttrs.showtickprefix,
4041
tickprefix: axesAttrs.tickprefix,
4142
showticksuffix: axesAttrs.showticksuffix,

test/image/baselines/14.png

0 Bytes
Loading

0 commit comments

Comments
 (0)