Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the seaborn palette to dress matplotlib with beautiful color matching

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to use the seaborn palette to dress matplotlib with beautiful colors. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Seaborn color Palett

Color palettes, as the name implies, essentially beautify the graphics from the perspective of color matching, such as the same set of data, using the default color matching (above) and the color palette adjusted to compare, you can feel that the following looks more comfortable!

So how to use the color palette? many tutorials on the Internet are very comprehensive, but readers will feel very confused because they are too comprehensive. Get up early and give you a summary.

First, let's import seaborn.

Import seaborn as sns

After that, you only need to adjust the global color scheme directly through sns.set_palette (xxxx). Remember, .set_palette is a global application for your configured color palette, and the xxxx in it is our incoming color palette.

So what exactly is xxxx? let's take a look at the official document seaborn.set_palette (palette, n_colors=None, desat=None, color_codes=False).

Palette is the most important color palette, and the other parameters are the number of colors, saturation and other settings.

So first of all, we need to fix the color palette. Of course, some default configurations are provided in seaborn. These official configurations can be used easily. Here are some common color matches.

Deep

Muted

Pastel

Bright

Dark

Colorblind

Paried

Accend

Blues

BrBg

Magma

For example, setting sns.set_palette ("pastel", 8) is what we just used to compare color matching.

You can try more default color matching by yourself. there are about hundreds of configured color palettes, which will not be displayed one by one.

In addition to the default configuration of the color palette, we can also further set it ourselves, and then we can use details such as seaborn.husl_palette to further modify it.

Seaborn.husl_palette (n_colors=6, hue 0.01, spore 0.9, lump 0.65)

N_colors: number of colors h: first hue s: saturation l: brightness Thank you for reading! This is the end of the article on "how to use the seaborn palette to dress matplotlib with beautiful colors". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report