Themes and Theme Customization in R
📖 Scenario: You are creating a simple bar chart to show sales data for different products. You want to make the chart look nicer by changing the theme colors and text styles.
🎯 Goal: Build a bar chart using ggplot2 with a customized theme that changes the background color, text size, and axis titles.
📋 What You'll Learn
Create a data frame called
sales_data with products and their sales numbersCreate a variable called
base_size to set the base font size for the themeUse
ggplot() to create a bar chart with geom_bar() using sales_dataCustomize the plot theme using
theme() to change background color, axis title size, and text colorPrint the final plot
💡 Why This Matters
🌍 Real World
Customizing themes helps make charts clearer and more attractive for presentations and reports.
💼 Career
Data analysts and scientists often need to adjust chart styles to match company branding or improve readability.
Progress0 / 4 steps