0
0
Matplotlibdata~15 mins

Figure size for publication in Matplotlib - Mini Project: Build & Apply

Choose your learning style9 modes available
Figure size for publication
📖 Scenario: You are preparing a graph to include in a scientific paper. The journal requires figures to be exactly 6 inches wide and 4 inches tall for consistent formatting.
🎯 Goal: Create a matplotlib plot with the exact figure size required by the journal, then display a simple line plot.
📋 What You'll Learn
Create a figure with size 6 inches wide and 4 inches tall using matplotlib
Plot a simple line graph with points (1, 1), (2, 4), (3, 9)
Display the plot
💡 Why This Matters
🌍 Real World
Researchers and scientists often need to prepare figures that fit exact size requirements for journals or presentations.
💼 Career
Knowing how to control figure size and create clear plots is essential for data scientists and analysts who share visual results.
Progress0 / 4 steps
1
Create the data points
Create two lists called x and y with values [1, 2, 3] and [1, 4, 9] respectively.
Matplotlib
Need a hint?

Use square brackets to create lists. For example, x = [1, 2, 3].

2
Set the figure size
Import matplotlib.pyplot as plt and create a figure with size 6 inches wide and 4 inches tall using plt.figure(figsize=(6, 4)).
Matplotlib
Need a hint?

Use import matplotlib.pyplot as plt to import, then plt.figure(figsize=(6, 4)) to set size.

3
Plot the line graph
Use plt.plot(x, y) to plot the line graph with the data points.
Matplotlib
Need a hint?

Use plt.plot(x, y) to draw the line connecting the points.

4
Display the plot
Use plt.show() to display the plot on the screen.
Matplotlib
Need a hint?

Call plt.show() to open the plot window.