'How to label axis ticks in a scientific notation as in latex?
plot(1:10, (1:10)*1e6, xaxt='n', yaxt='n', xlab='', ylab='')
axis(2, (1:10)*1e6, (1:10)*1e6, las=2)
The axis ticks are shown as "1e+06", ...
How to show them like $1 \times 10^6$ (as in latex), ...?
Solution 1:[1]
Maybe not super elegant, but this seems to work:
plot(1:10, (1:10)*1e6, xaxt='n', yaxt='n', xlab='', ylab='')
labs <- sapply(sprintf("%d %%*%% 10^6", 1:10), \(x) parse(text = x))
axis(2, (1:10)*1e6, labs, las=2)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | cmhh |
