show ( ) # Turn off the confidence intervals show ( ) Customizing bar plots # Rearrange the categories ![]() catplot (x = "Gender", y = "Interested in Math" ,ĭata =survey_data, kind = "bar" ) # Show plot show ( ) Bar plots with percentages # Create a bar plot of interest in math, separated by gender ![]() Kind = "count", col = "Age Category" ) # Show plot catplot (y = "Internet usage", data =survey_data , show ( ) # Create column subplots based on age category catplot (x = "Internet usage", data =survey_data , show ( ) Visualizing a Categorical and a Quantitative Variable Count plots # Create count plot of internet usage # Add markers and make each line have the same style # Change to create subgroups for country of origin relplot (x = "model_year", y = "horsepower" , show ( ) Plotting subgroups in line plots # Import Matplotlib and Seaborn import matplotlib. Visualizing standard deviation with line plots # Make the shaded area show the standard deviation The distribution of miles per gallon is smaller in 1973 compared to 1977. show ( ) Interpreting line plots # Import Matplotlib and Seaborn import matplotlib. Style = "origin", hue = "origin" ) # Show plot relplot (x = "acceleration", y = "mpg" , # Create a scatter plot of acceleration vs. show ( ) Changing the style of scatter plot points # Import Matplotlib and Seaborn import matplotlib. Size = "cylinders", hue = "cylinders" ) # Show plot show ( ) Changing the size of scatter plot points # Import Matplotlib and Seaborn import matplotlib. show ( ) # Adjust further to add subplots based on family support show ( ) # Adjust to add subplots based on school supportĬol_order = ) # Show plot show ( ) 1 Creating two-factor subplots # Create a scatter plot of G1 vs. show ( ) # Change this scatter plot to arrange the plots in rows instead of columns show ( ) # Change to make subplots based on study time relplot (kind = "scatter" ,x = "absences", y = "G3" , show ( ) Visualizing Two Quantitative Variables Creating subplots with col and row # Change to use relplot() instead of scatterplot() countplot (data =student_data ,x = "school" ,hue = "location" ,palette =palette_colors ) # sns里subplot如何创建? # Display plot Palette_colors = # Create a count plot of school with location subgroups # Create a dictionary mapping subgroup values to colors show ( ) Hue and count plots # Import Matplotlib and Seaborn import matplotlib. Hue = "location" ,hue_order = ) # Show plot # Change the legend order in the scatter plot show ( ) Hue and scatter plots # Import Matplotlib and Seaborn import matplotlib. countplot (x = "Spiders" ,data =df ) # Display the plot read_csv (csv_filepath ) # Create a count plot with "Spiders" on the x-axis Making a count plot with a DataFrame # Import Matplotlib, Pandas, and Seaborn import matplotlib. head ( ) ) No, because a single column contains different types of information. read_csv (csv_filepath ) # Print the head of df print (df. “untidy” data # Import Pandas import pandas as pdĭf = pd. # Create count plot with region on the y-axis show ( ) Making a count plot with a list # Import Matplotlib and Seaborn import matplotlib. scatterplot (x =gdp, y =percent_literate ) # Show plot # Change this scatter plot to have percent literate on the y-axis show ( ) # Import Matplotlib and Seaborn import matplotlib. scatterplot (x =gdp, y =phones ) # Show plot scatterplot (gdp ,phones ) # Import Matplotlib and Seaborn import matplotlib. # Create scatter plot with GDP on the x-axis and number of phones on the y-axis # Import Matplotlib and Seaborn import matplotlib. ![]() Introduction to Seaborn Making a scatter plot with lists # Import Matplotlib and Seaborn import matplotlib. 4.9 Bar plot with subgroups and subplots.4.5 Adding a title to a FacetGrid object.3 Visualizing a Categorical and a Quantitative Variable.2.7 Visualizing standard deviation with line plots.2.5 Changing the style of scatter plot points.2.4 Changing the size of scatter plot points.2 Visualizing Two Quantitative Variables.1.4 Making a count plot with a DataFrame.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |