VOOZH about

URL: https://www.geeksforgeeks.org/javascript/d3-js-transpose-function/

⇱ D3.js transpose() Function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

D3.js transpose() Function

Last Updated : 15 Jul, 2025

The transpose() function in D3.js is used to return the transpose of a 2D array. This function helps to visualize the data and making graphs and charts.

Syntax:

d3.transpose(Matrix);

Parameters: This function accept a single parameter as mentioned above and described below:

  • Matrix: This parameter holds a matrix as a 2d array

Return value: It returns an array or the matrix.

Below given are a few examples of transpose function.

Example 1: Without using zip function to form a matrix.

Output:

👁 Image

Example 2: Using zip function to form a matrix.

Output:

👁 Image

Supported Browsers:

  • Google Chrome
  • Internet Explorer
  • Mozilla Firefox
  • Safari
  • Opera
Comment
Article Tags: