Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons

© 2026 BraveProgrammer. All rights reserved.

  1. Courses
  2. /
  3. Master Data Science with Python

Lesson 33 of 60 · python

Customizing Plots: Styles, Labels, Legends, and Themes

Duration: 20 minutes

Customizing Your Visuals

A polished plot conveys information more effectively.

Changing style globally

plt.style.use('seaborn-darkgrid')   # or 'ggplot', 'fivethirtyeight'

Adding titles and axis labels

plt.plot(x, y)
plt.title('My Fancy Plot', fontsize=14, fontweight='bold')
plt.xlabel('X‑axis label', fontsize=12)
plt.ylabel('Y‑axis label', fontsize=12)

Adding a legend

plt.plot(x, y, label='Series 1')
plt.plot(x, y2, label='Series 2')
plt.legend(loc='upper left', fontsize=10, frameon=True)

Customizing ticks

plt.xticks(ticks=[0, 0.5, 1.0], labels=['Zero', 'Half', 'One'])
plt.yticks(rotation=45)

Adding annotations

plt.annotate('Peak', xy=(2, 9), xytext=(3, 12),
             arrowprops=dict(facecolor='black', shrink=0.05))

Using a color map for continuous data

plt.scatter(x, y, c=y, cmap='viridis')
plt.colorbar(label='Intensity')

Exporting at high resolution

plt.savefig('my_plot.pdf', format='pdf', dpi=300)

Info

Consistency matters – pick a style and stick with it across all figures for a professional look.

Previous: Line, Scatter, and Bar ChartsNext: Subplots, Grids, and Layouts