[ Web Proxy ]
URL:
Viewing: https://plot.ly/javascript/log-plot/ [Back]  [Original]

Log plots in JavaScript
Quick Reference On This Page
Sign up for the upcoming webinar: Introducing Plotly Studio Embedded [Sign up for the upcoming webinar: Introducing Plotly Studio Embedded]

Log Plots in JavaScript

How to make a plot with D3.js-based logarithmic axes in javascript.


Plotly Studio: Transform any dataset into an interactive data application in minutes with AI. Try Plotly Studio now.

var trace1 = {
  x: [0, 1, 2, 3, 4, 5, 6, 7, 8],
  y: [8, 7, 6, 5, 4, 3, 2, 1, 0],
  type: 'scatter'
};

var trace2 = {
  x: [0, 1, 2, 3, 4, 5, 6, 7, 8],
  y: [0, 1, 2, 3, 4, 5, 6, 7, 8],
  type: 'scatter'
};

var data = [trace1, trace2];

var layout = {
  xaxis: {
    type: 'log',
    autorange: true
  },
  yaxis: {
    type: 'log',
    autorange: true
  }
};

Plotly.newPlot('myDiv', data, layout);
plotly-studio.png [plotly-studio.png]
Copyright © 2026 Plotly. All rights reserved.

Web Proxy Viewer  |  New URL  |  Original Page