थीम सेट करना
कई प्लॉट्स में एक ही थीम दोबारा इस्तेमाल करने से एक समान स्टाइल मिलता है। इसके लिए आपके पास कुछ विकल्प हैं।
- थीम को किसी वैरिएबल में असाइन करें और हर प्लॉट में उसे जोड़ें।
theme_set()का उपयोग करके अपनी थीम को डिफॉल्ट के रूप में सेट करें।
एक अच्छी रणनीति, जिसे आप यहाँ इस्तेमाल करेंगे, यह है कि किसी बिल्ट-इन थीम से शुरू करें और फिर उसे मॉडिफाई करें।
plt_prop_unemployed_over_time उपलब्ध है। आपने पहले जो थीम बनाई थी, वह नमूना कोड में दिखाई गई है।
यह अभ्यास पाठ्यक्रम का हिस्सा है
ggplot2 के साथ डेटा विज़ुअलाइज़ेशन परिचय
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Save the theme as theme_recession
___ <- theme(
rect = element_rect(fill = "grey92"),
legend.key = element_rect(color = NA),
axis.ticks = element_blank(),
panel.grid = element_blank(),
panel.grid.major.y = element_line(color = "white", size = 0.5, linetype = "dotted"),
axis.text = element_text(color = "grey25"),
plot.title = element_text(face = "italic", size = 16),
legend.position = c(0.6, 0.1)
)
# Combine the Tufte theme with theme_recession
theme_tufte_recession <- ___
# Add the Tufte recession theme to the plot
___