Skip to content
CampusEduX

Problem 1: Create Two Subplots Side by Side

Easypython
Learn the Concept: Matplotlib (Condensed Reference)

Problem Description

Write a Python program that creates a figure with 2 subplots side by side: a line chart of monthly sales on the left, and a bar chart of subject scores on the right.

Input

Monthly sales data and subject score data.

Output

A displayed figure with both charts side by side.

Constraints

  • Use plt.subplots(1, 2).

Example Input

text
months=["Jan","Feb","Mar"], sales=[100,150,130] subjects=["Math","Science"], scores=[85,78]

Example Output

text
(A figure with a line chart on the left and a bar chart on the right)

Concepts Covered

plt.subplots(), individual axes plotting.

Related Problems

  • Problem 2: Add Titles and a Figure-Wide Title
    Easy · python
    Solve Problem
  • Problem 3: Save a Figure to a File
    Easy · python
    Solve Problem
  • Problem 4: Build a 2x2 Dashboard of Four Charts
    Easy · python
    Solve Problem

Input (stdin)

Output

Run your code to see output here...