التقسيمات وHue وStyle
تقسيم المخططات حسب الفئة
التقسيمات وHue وStyle درس مجاني في Data Science Academy على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Data Science Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Data Science Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
One Chart, Many Slices
Sometimes one plot hides too much. Faceting splits your data into a grid of small charts, one per category, so each group gets its own view.
Encode Groups With hue
The lightest way to compare groups is color. hue maps a category to colors inside a single plot, no extra panels needed.
sns.scatterplot(data=df, x="x", y="y", hue="group")Split Into Columns
To break groups into separate panels, use a figure-level plot with col. Each category becomes its own side-by-side chart.
sns.relplot(data=df, x="x", y="y", col="group")Split Into Rows Too
Pair col with row to build a full grid. One variable spreads across columns while another stacks down the rows.
sns.relplot(data=df, x="x", y="y", col="region", row="year")Figure-Level vs Axes-Level
Faceting needs figure-level functions like relplot, displot, and catplot. The plain plots such as scatterplot live inside a single panel.
Wrap Long Facet Rows
Many categories make an endless row. col_wrap tells seaborn how many panels to allow before starting a new line.
sns.relplot(data=df, x="x", y="y", col="city", col_wrap=3)Style Encodes Without Color
Beyond color, style maps a category to marker shapes or dashed lines, helping when prints are black and white.
sns.lineplot(data=df, x="x", y="y", style="device")Pick a Color Palette
Swap the colors with palette. Choose a vivid set for distinct groups or a gradient for values that go from low to high.
sns.scatterplot(data=df, x="x", y="y", hue="group", palette="viridis")Set the Overall Look
One call restyles every chart at once. set_theme controls the background, gridlines, and default palette for the session.
sns.set_theme(style="darkgrid", palette="muted")Combine hue and Facets
You can layer them: color within each panel and split panels by another field. Just avoid encoding so much that the message gets lost.
sns.relplot(data=df, x="x", y="y", hue="sex", col="day")Less Is Often More
Every extra hue, style, and facet adds load for the reader. Aim for the simplest view that still answers the question.
Quick Check
You want each category drawn in its own separate panel.
Recap: Encode, Facet, Style
You now layer information with hue and style, split groups using facets, and theme it all cleanly, while keeping the chart easy to read. 🎨
الأسئلة الشائعة
هل درس «التقسيمات وHue وStyle» مجاني؟
نعم — نص درس «التقسيمات وHue وStyle» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Data Science Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Data Science Academy 4 دروس في المجموع.
ماذا ستتعلم في «التقسيمات وHue وStyle»؟
تقسيم المخططات حسب الفئة تتمرن على Data Science Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Data Science Academy؟
لا تُشترط خبرة سابقة. Data Science Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.
كم من الوقت يستغرق درس «التقسيمات وHue وStyle»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Data Science Academy هذا؟
نعم. كل درس في Data Science Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- لماذا seaborn أفضل من matplotlib الخام
- التوزيعات: hist وkde وbox
- العلاقات: scatter وline
- التقسيمات وHue وStyle