Chapter 61: Plot Graphics
1. What is “Plot Graphics” actually? (Very clear definition first)
Plot Graphics (or simply plotting in most contexts) means creating visual graphs, charts, curves, points, bars, lines, areas, or any picture that shows numbers, data, mathematical functions, or relationships in an easy-to-understand way.
In other words:
You have boring lists of numbers (like temperature readings, sales figures, exam marks, stock prices, scientific measurements) → You plot them → draw dots / lines / bars / curves on a graph → Now anyone can see the story very quickly (rising trend, sudden drop, comparison, pattern, outlier, etc.)
In student life, “Plot Graphics” almost always refers to:
- Drawing graphs using Python (Matplotlib, Seaborn, Plotly)
- Or JavaScript libraries (Chart.js, D3.js, Plotly.js)
- Or MATLAB / Octave / R / Excel graphs
The word “plot” comes from old mathematics → “to plot a point” means put a dot at (x,y) coordinates.
So Plot Graphics = turning numbers into meaningful pictures.
2. Why do we do Plot Graphics? (Real reasons you should care)
- Numbers are hard to understand alone 100 temperature readings = boring table One line graph = instantly see “temperature rises every afternoon”
- Spot patterns & trends Sales data → plot shows sudden spike in December (Christmas sales?)
- Compare things easily Marks of Class A vs Class B → bar chart shows who did better
- Find mistakes / unusual values Most points follow a straight line, one point is far away → probably error in measurement
- Prove theories / understand math Plot y = x² → you immediately see perfect parabola
- Make reports & presentations professional Teachers, project guides, interviewers, clients love graphs — not long tables
- Predict future (very important in data science) Plot past stock prices → extend the line → guess tomorrow
3. Most Common Types of Plots (You will use these 90% of the time)
| Plot Type | Looks like | Best used for | Real-life example you have seen |
|---|---|---|---|
| Line Plot | Points connected by lines | Change over time / continuous data | Temperature over 24 hours, stock price daily |
| Scatter Plot | Just individual dots (no lines) | Relationship between two variables | Height vs Weight of students, age vs salary |
| Bar Chart | Vertical or horizontal bars | Compare categories / groups | Sales of Phone A vs Phone B vs Phone C |
| Histogram | Bars showing how many times each value occurs | Distribution / frequency of data | Marks distribution in class (how many got 70–80?) |
| Pie Chart | Circle divided into colored slices | Show percentage / proportion of whole | Budget: food 40%, rent 30%, savings 30% |
| Area Chart | Line plot with area filled below | Cumulative totals over time | Total users growth month by month |
4. Your First Plotting Example – Very Simple Line Plot (Copy-Paste & Run)
We will use Python + Matplotlib — this is what almost every Indian college teaches first for plotting.
Step 1: Install Matplotlib (do once in terminal / command prompt)
|
0 1 2 3 4 5 6 |
pip install matplotlib |
Step 2: Create file first-plot.py and paste this:
|
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# Import the plotting library import matplotlib.pyplot as plt # Our data: hours of the day and temperature in °C hours = [0, 3, 6, 9, 12, 15, 18, 21, 24] temperature = [22, 20, 19, 24, 30, 32, 29, 26, 23] # Create the line plot plt.plot(hours, temperature, color='red', # line color marker='o', # circle marker at each point linestyle='-', # solid line (-), dashed (--), dotted (:) linewidth=2, # thickness of line markersize=8, # size of dots label='Temperature') # name for legend # Add meaning to the graph plt.title("Temperature Over 24 Hours", fontsize=16, fontweight='bold') plt.xlabel("Time (hours)", fontsize=12) plt.ylabel("Temperature (°C)", fontsize=12) # Add grid lines (makes reading values easy) plt.grid(True, linestyle='--', alpha=0.7) # Show legend (if you have multiple lines) plt.legend() # Show the graph window plt.show() |
Run it: Open terminal → go to folder → type python first-plot.py
What you see:
- Red line with circles at each data point
- Temperature low at night → high in afternoon → low again
- Clear title, x-axis (hours), y-axis (°C), grid, legend
This is your first real plot — congratulations! 🎉
5. Step-by-Step: How We Made This Plot (Blackboard Style)
- Import Matplotlibimport matplotlib.pyplot as plt → pyplot is the main module for plotting
- Prepare two lists
- x-values (hours)
- y-values (temperature)
- Plot commandplt.plot(x, y, options…) → draws line connecting points + markers
- Customize look color, marker, linestyle, linewidth, markersize, label
- Add meaning title, xlabel, ylabel, grid, legend
- Displayplt.show() — opens window with graph
6. Teacher’s Quick Tips (Hyderabad Student Style 😄)
- Always label axes + title — teacher will deduct marks if missing!
- Use plt.grid(True) — makes reading values very easy
- Common mistake #1: Lists of different lengths → error
- Common mistake #2: Forget plt.show() → nothing appears
- Common mistake #3: No import matplotlib.pyplot as plt → NameError
- Pro tip: Add plt.tight_layout() before plt.show() → prevents label cutting
- Pro tip 2: Save for project report: plt.savefig(‘temperature.png’, dpi=300)
Understood what Plotting is now? Plotting is one of the most important skills in data science, engineering, physics, maths, economics — it turns boring numbers into clear stories everyone can understand quickly.
Tell me honestly — do you want to go deeper right now?
- Bar chart example (compare 5 products sales)?
- Scatter plot (height vs weight)?
- Multiple lines on same graph (temperature vs humidity)?
- Plot mathematical functions (y = x², y = sin(x))?
- Full 20-question plotting quiz?
Just say — we can build any plot together step by step! 🚀
