YYDS! Dexplot: one line of Python code to easily draw statistical charts!

Python learning and data mining 2021-10-29 07:54:18
yyds dexplot line python code

Today I recommend a lightweight Python Statistical drawing library :Dexplot, So you don't have to use Python-matplotlib Library can draw exquisite statistical charts . Take a look at this lightweight statistical mapping Library ~, Welcome to collect and learn , Like to like and support , At the end of the article, a technical exchange group is provided .

Python-Dexplot brief introduction

Dexplot The official website of the library is as follows :https://www.dexplo.org/dexplot/ , More content not covered in this tweet , You can check this website by yourself ~

Dexplot The installation of the library is also very simple , as follows :

pip install dexplot

Dexplot The library also supports “ Long data ” and “ Wide data ” type , This and R-ggplot2 The data types required for drawing are similar (ggplot2 Only long data is supported ), The following two figures show what long data and wide data are :

 picture

 picture

Dexplot The library provides drawing functions for drawing different charts , But its basic usage syntax is as follows :

dxp.plotting_func(x, y, data, aggfunc, split, row, col, orientation, ...)

The parameters are explained as follows :

  • x: Along the x The column name of the axis

  • y: Along the y The column name of the axis

  • data:Pandas DataFrame data type .

  • aggfunc:pandas Common clustering calculation functions .

  • split: Data column names that divide data into different groups .

  • row: Data column name used to split data into different subgraphs by row .

  • col: Data column name used to split data into different subgraphs by column .

  • orientation: Drawing direction , Have vertical (‘v’) Or level (‘h’). The default setting for most graphs is vertical .

Dexplot The drawing library mainly provides two data types: cluster map and distribution map , The aggregation graph takes a series of values , And use the information provided to aggfunc The function of returns a single value , The distribution diagram takes a series of values and describes the distribution shape in some way .

Next , Learn quickly Python It will be shown through specific visual charts Dexplot Library drawing charm .

Python-Dexplot Sample display

「 Example 1 」: Column chart series

import dexplot as dxp
import pandas as pd
import matplotlib.pyplot as plt
airbnb = dxp.load_dataset('airbnb')
#bar01 
dxp.bar(x='neighborhood', y='price', data=airbnb, aggfunc='median',figsize=(5,3.5),
bar_kwargs={
"color":"#0073C2","ec":"black"})

 picture

Example01 of dxp.bar

Sort :

dxp.bar(x='neighborhood', y='price', data=airbnb, aggfunc='median',
figsize=(5,3.5),sort_values='asc',bar_kwargs={
"color":"#0073C2","ec":"black"}) ```
![Example02 of dxp.bar](https://mmbiz.qpic.cn/mmbiz_png/LVW0j64NZC0MPc5xgXYibNtoqBHhIEPfkW7DfjNejMLcibMJW2zGLPc6LJPpaYArp3upx2X9Y5ELricsalw4LCb4Q/640?wx_fmt=png)
level :
```python
dxp.bar(x='price', y='neighborhood', data=airbnb, aggfunc='median', figsize=(3,4),
orientation='h', sort_values='desc',bar_kwargs={
"color":"#EFC000","ec":"black"})

 picture

Example03 of dxp.bar

grouping :

dxp.bar(x='neighborhood', y='price', data=airbnb, aggfunc='median', split='superhost',figsize=(4,2.5),
cmap=["#0073C2","#EFC000"],bar_kwargs={
"ec":"black"})

 picture

Example04 of dxp.bar

Split up :

dxp.bar(x='neighborhood', y='price', data=airbnb, aggfunc='median', split='superhost',
col='property_type', col_order=['House', 'Condominium', 'Apartment'],
row='bedrooms', row_order=[1, 2, 3], sharey=False,cmap=["#0073C2","#EFC000"],
bar_kwargs={
"ec":"black"})

 picture

Example05 of dxp.bar

「 Example 2 」: Box diagram series

dxp.box(x='price', y='neighborhood', data=airbnb,cmap=["#CD534C"],figsize=(3,3))

 picture

Example01 of dxp.box

grouping :

dxp.box(x='price', y='neighborhood', data=airbnb,figsize=(3,3.5),
cmap=["#0073C2","#EFC000","#868686","#CD534C"],
split='property_type', split_order='desc')

 picture

Example02 of dxp.box

「 Example 3 」: Density map (KDE)

dxp.kde(x='price', data=airbnb, split='bedrooms', split_order=[1, 2, 3],
cmap=["#0073C2","#EFC000","#868686"])

 picture

Example of dxp.kde

「 Example 4 」: Scatter plot

dxp.scatter(x='longitude', y='latitude', data=airbnb,
split='neighborhood', col='bedrooms', col_order=[2, 3])

 picture

Example of dxp.scatter

Okay , The above is to learn quickly Python List several representative charts , More chart types and drawing methods , Interested partners can explore by themselves ~

summary

Today I introduced a lightweight Python Statistical drawing library , It can be seen that , Using this library to draw statistical charts requires only one line of code .

But it requires high visualization ( Color 、 Layout 、 Scale and other attributes are customized ) Little buddy , Still suggest learning R-ggplot2 and Python-matplotlib. Each have advantages and disadvantages , Partners choose drawing tools according to their preferences ~~


Technical communication

Welcome to reprint 、 Collection 、 Gain some praise and support !

 Insert picture description here

At present, a technical exchange group has been opened , Group friends have exceeded 2000 people , The best way to add notes is : source + Interest direction , Easy to find like-minded friends

  • The way ①、 Send the following picture to wechat , Long press recognition , The background to reply : Add group ;
  • The way ②、 Add microsignals :dkl88191, remarks : come from CSDN
  • The way ③、 WeChat search official account :Python Learning and data mining , The background to reply : Add group

 Long press attention

版权声明
本文为[Python learning and data mining]所创,转载请带上原文链接,感谢
https://pythonmana.com/2021/10/20211013194026751d.html

  1. Python,前缀后缀相同时合并
  2. 关于#python#的问题:python
  3. 關於#python#的問題:python
  4. Python,前綴後綴相同時合並
  5. Questions sur # # Python #: Python
  6. Python, préfixe et suffixe combinés en même temps
  7. python manage.py shell无法运行,
  8. python manage.py shell無法運行,
  9. Le shell Python manage.py ne fonctionne pas,
  10. python中使用vscode Import 'matplotlib.pyplot' could not be resolved from source 问题
  11. [Chapter 11 of the full version] Python advanced crawler practice - system master Po anti climbing skills challenge high salary
  12. L'utilisation de vscode Import 'matplotlib.pyplot' en python ne peut pas être résolue à partir du problème source
  13. Python fusionne les deux listes et supprime les éléments dupliqués lors de la fusion
  14. [JS Reverse AES Reverse Encryption] python crawler combat, les jours sont de plus en plus décisifs
  15. 30 jeux Python. Je peux jouer à la pêche au travail pendant une journée.
  16. J'a i collecté un nouveau hit de liste en python, donc c'est un secret que quelqu'un d'autre peut devenir un magnat des médias!
  17. J'a i utilisé Python pour ramper à travers 5000 belles photos de papier peint, un jour oublié Premier amour!
  18. [Python planting system] the best green plant for your girlfriend. Girls love it when they see it! Attachment: should be able to feed - right??!
  19. [Python love guide] two small programs for sweetness burst table are released! Afraid you can't find someone?
  20. J'ai utilisé Python pour ramper 1000 lettres d'amour pour aider mon colocataire à exprimer les fleurs de classe, mais les inverser et les inverser... C'est le secret ultime des fleurs de classe!
  21. J'ai utilisé Python pour me connecter à la plus grande plate - forme de jeu au monde, et à quel point le cryptage steam est intelligent [code source inclus]
  22. python中列表转为矩阵后无法进行矩阵的乘法运算
  23. Python crawler Development and Learning full tutoriel 2nd Edition, banggan 100000 words [recommended Collection]
  24. Python crawler haut de gamme: microstore confus anti - décryptage
  25. La multiplication de la matrice ne peut pas être effectuée lorsque la liste est convertie en matrice en python
  26. Introduction to operators in python (Part 1)
  27. Are the dictionaries in Python ordered
  28. Introduction to dictionaries in Python
  29. List introduction in Python
  30. pandas比较两个dataframe特定数据列的数值是否相同并给出差值:使用np.where函数
  31. Python使用matplotlib绘制透明背景的可视化图像并保存透明背景的可视化结果(transparent background)
  32. Python self study notes -- basic grammar
  33. Python utilise matplotlib pour dessiner une image visuelle de l'arrière - plan transparent et enregistrer les résultats visuels de l'arrière - plan transparent
  34. Pandas compare les valeurs de deux colonnes de données spécifiques à dataframe et donne des valeurs de voyage: en utilisant la fonction np.where
  35. Comment configurer une application ASGI Django avec Postgres, nginx et uvicorn sur Ubuntu 20.04
  36. What are the advantages of Python and how to get started quickly
  37. Python self study notes -- basic data types
  38. Python code reading (Chapter 14): List Union
  39. Analyse statistique de la fonction de données des essais aléatoires Python
  40. Alien invasion project in Python application -- Aliens (Part 2)
  41. Python code reading (Chapter 14): List Union
  42. Lecture du Code Python (article 25): diviser les chaînes multilignes en listes
  43. Python self study notes -- operators
  44. Formation python - différences entre http et HTTPS
  45. Implementation of automatic timing comment function on Python CSDN platform
  46. python+tkinter+treeview子控件快捷键
  47. Raccourcis clavier pour les sous - contrôles Python + tkinter + treeview
  48. Analyse des données Python
  49. python+tkinter+treeview子控件快捷鍵
  50. Devine si je peux attraper Maotai avec la programmation python? Tout est ouvert à github
  51. À propos de pygame.display.set in Python Un petit problème avec mode ()
  52. Implementation of automatic timing comment function on Python CSDN platform
  53. python:dataframe进行iteritem遍历时如何将输出结果按照列分别输出为该列最后一行
  54. python:dataframe進行iteritem遍曆時如何將輸出結果按照列分別輸出為該列最後一行
  55. Python: comment le dataframe affiche les résultats de sortie par colonne à la dernière ligne de la colonne lors de la traversée de l'itemitem
  56. Écrivez un gadget de bureau pour votre fille préférée en python et elle dit que c'est génial!
  57. Introduction to closures in Python 3
  58. Global / nonlocal usage in Python 3
  59. Introduction to context manager in Python 3
  60. Common standard library random, python introductory tutorial 5 or 6 questions a day | Python skill tree