1. Home
  2. Data Science
  3. Matplotlib
  4. What is the purpose of the plt.twinx() function in…

Added 24 Feb 2024

What is the purpose of the plt.twinx() function in Matplotlib?

  1. To create a twin subplot sharing the y-axis
  2. To create a twin subplot sharing the x-axis
  3. To create a new figure
  4. To create a secondary y-axis Correct answer

Correct answer

D. To create a secondary y-axis

15 views

MCQSEXAM

Explanation

plt.twinx() creates a second y-axis that shares the same x-axis, which lets you plot two datasets with different y-scales on one figure.

Doubts & discussion

Not sure why the answer is D? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Matplotlib MCQs

Practise all Matplotlib MCQs

Similar MCQs