Update seaborn-basics.md

pull/766/head
Rishi Goswami 2024-05-31 20:57:53 +05:30 zatwierdzone przez GitHub
rodzic 03920cd750
commit 5ffcbf2134
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
1 zmienionych plików z 20 dodań i 0 usunięć

Wyświetl plik

@ -17,3 +17,23 @@ sns.relplot(
x="total_bill", y="tip", col="time",
hue="smoker", style="smoker", size="size",
)
```
Below is the output for the above code snippet:
![Seaborn intro image](images/seaborn-basics.png)
```Python
# Load an example dataset
tips = sns.load_dataset("tips")
```
Most code in the docs will use the `load_dataset()` function to get quick access to an example dataset. Theres nothing special about these datasets: they are just pandas data frames, and we could have loaded them with `pandas.read_csv()` or build them by hand. Most of the examples in the documentation will specify data using pandas data frames, but Seaborn is very flexible about the data structures that it accepts.
```Python
# Create a visualization
sns.relplot(
data=tips,
x="total_bill", y="tip", col="time",
hue="smoker", style="smoker", size="size",
)
```
This plot shows the relationship between five variables in the tips dataset using a single call to the seaborn function `relplot()`. Notice how we provided only the names of the variables and their roles in the plot. Unlike when using matplotlib directly, it wasnt necessary to specify attributes of the plot elements in terms of the color values or marker codes. Behind the scenes, seaborn handled the translation from values in the dataframe to arguments that Matplotlib understands. This declarative approach lets you stay focused on the questions that you want to answer, rather than on the details of how to control matplotlib.