I need to add 2, 3, 4, 5, 6, 7, 8, 9…. ticks on the y-axis. My chart is very tall, so I have enough room to do this. How can I do this?
var trace1 = {
x: [7, 8],
y: [1, 10000000000],
type: 'scatter'
};
var data = [trace1];
var layout = {
width: 500,
height: 800,
xaxis: {
autorange: true
},
yaxis: {
type: 'log',
dtick: 1,
autorange: true
}
};
Plotly.newPlot('myDiv', data, layout);
<head>
<!-- Load plotly.js into the DOM -->
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>
<body>
<div id='myDiv'><!-- Plotly chart will be drawn inside this DIV --></div>
</body>
You need to set
dtick: 'D1'
. @seedtick
Thank you. Unfortunately this is only a partial solution. Next to the numbers
2, 3, 4...
there are no lettersk, M, B...
for thousands, millions, billions…This would be redundant, those are the steps in between ticks, usually text is minimized for smaller steps. You can still set the ticks manually, @see
tickmode
,tickvals
andticktext
.It won’t be redundant if your graph has a high heihgt with a large vertical scroll slider. It turns out that in some parts of the graph it is not clear whether it is
k
,M
orB
.