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 sns.set_context () for Seaborn in Python

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

The editor will share with you how Seaborn in Python uses sns.set_context (). I hope you will get something after reading this article. Let's discuss it together.

Sns.set_context ()

In the previous figure, the label size looked very small. If you don't like the default settings, we can use sns.set_context () to change the context parameters.

I use this function mainly to control the default font size of the labels in the drawing. By changing the default values, we can save time without having to resize fonts for different elements of a single drawing (such as axis labels, headings, legends). Let's change the context to "talk" and look at the figure:

# default context change sns.set_context ('talk') # figure plt.figure (figsize= (9,5)) sns.scatterplot (data=df, xylene / bodyweight massages, alpha=0.7 / hue='species', size='gender') plt.legend (loc='upper right', bbox_to_anchor= (1.3,1))

It's easier to recognize, isn't it? Another option you can try is "poster", which will increase the default size or more.

After reading this article, I believe you have some understanding of "how Seaborn in Python uses sns.set_context ()". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

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

Development

Wechat

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

12
Report