Solution 2: Matplotlib for Data Visualization

Let’s look at the solution to the above challenge.

We'll cover the following


  • Create a figure object.
  • Put two axes on the figure at [0,0,1,1] and [0.1,0.6,0.2,0.2].
  • Plot data(x,y) on main axes.
  • Plot data(x,z) on the small axes and set its x limit b/w 1, 2, y limit 0, 5.
  • Replicate the figure to axes, titles, legends etc.

Write a code to create a figure which matches the figure below.

Get hands-on with 1200+ tech skills courses.