श्रेणीबद्ध पैलेट्स

Python में अपनी डेटा विज़ुअलाइज़ेशन बेहतर करें

Nick Strayer

Instructor

श्रेणीबद्ध डेटा के उदाहरण के तौर पर देशों, शहरों, और पक्षियों वाले तीन पैनल

Python में अपनी डेटा विज़ुअलाइज़ेशन बेहतर करें

बोध की सीमाएँ

  • श्रेणियाँ 10 या कम रखें
  • कलर-ब्लाइंडनेस का ध्यान रखें
sns.palplot(sns.color_palette('Set2', 11))

बहुत सारी रंगों की पट्टियाँ जो अधिक संख्या के कारण अलग पहचानना कठिन हैं

Python में अपनी डेटा विज़ुअलाइज़ेशन बेहतर करें
# Assign a new column to dataframe the desired combos
pollution['interesting cities'] = [x if x in ['Long Beach', 'Cincinnati'] 
                                   else 'other' for x in pollution['city'] ]

sns.scatterplot(x="NO2", y="SO2", hue = 'interesting cities', palette='Set2',
                data=pollution.query('year == 2014 & month == 12'))

स्कैटर प्लॉट जिसमें Long Beach और Cincinnati को अलग रंग मिले हैं और बाकी सभी शहर "other" रंग में हैं

Python में अपनी डेटा विज़ुअलाइज़ेशन बेहतर करें
colorbrewer_palettes = ['Set1',   'Set2',    'Set3',    'Accent', 
                        'Paired', 'Pastel1', 'Pastel2', 'Dark2']

for pal in colorbrewer_palettes: 
    sns.palplot(pal=sns.color_palette(pal))
    plt.title(pal, loc = 'left')

उपलब्ध श्रेणीबद्ध कलर पैलेट्स की एक श्रृंखला

Python में अपनी डेटा विज़ुअलाइज़ेशन बेहतर करें

ओर्डिनल डेटा (a)

  • कक्षाओं में क्रम होता है

  • अलग-अलग कक्षाओं की निश्चित संख्या

चार क्वारटाइल्स का आरेख

Python में अपनी डेटा विज़ुअलाइज़ेशन बेहतर करें

ओर्डिनल डेटा (b)

  • कक्षाओं में क्रम होता है

  • अलग-अलग कक्षाओं की निश्चित संख्या

सप्ताह के सात दिनों का आरेख

Python में अपनी डेटा विज़ुअलाइज़ेशन बेहतर करें

ओर्डिनल डेटा (c)

  • कक्षाओं में क्रम होता है

  • अलग-अलग कक्षाओं की निश्चित संख्या

इमोजी चेहरों से खुश से उदास तक के पैमाने का आरेख

Python में अपनी डेटा विज़ुअलाइज़ेशन बेहतर करें
colorbrewer_palettes = ['Reds', 'Blues', 'YlOrBr', 'PuBuGn', 'GnBu', 'Greys']

for i, pal in enumerate(colorbrewer_palettes): 
    sns.palplot(pal=sns.color_palette(pal, n_colors=i+4))

उपलब्ध ओर्डिनल पैलेट्स की एक श्रृंखला

Python में अपनी डेटा विज़ुअलाइज़ेशन बेहतर करें
# Make a tertials column using qcut()
pollution['NO2 Tertial'] = pd.qcut(pollution['NO2'], 3, labels = False)

# Plot colored by the computer tertials 
sns.scatterplot(x="CO", y="SO2", hue='NO2 Tertial', palette="OrRd",
                data=pollution.query("city == 'Long Beach' & year == 2014"))

CO और SO2 का स्कैटरप्लॉट, जिसमें NO2 के tertials को लाल ओर्डिनल स्केल में एन्कोड किया गया है

Python में अपनी डेटा विज़ुअलाइज़ेशन बेहतर करें

आइए कुछ श्रेणियों को रंगें

Python में अपनी डेटा विज़ुअलाइज़ेशन बेहतर करें

Preparing Video For Download...