1. Home
  2. Explore
  3. Computer Science
  4. Data Visualization with Python

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Data Visualization with Python

  • 34Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Data Visualization Basics
  • spaceFlip card
  • KI knew it
  • DI didn't know it
  • ←Previous card
  • →Next card

What is the primary purpose of data visualization?

Tap to flipClick to flipspace

To represent raw data in the form of graphs, making it easier to find patterns and insights from large datasets.

Or swipe the card

34 cards

  1. What is the primary purpose of data visualization?

    To represent raw data in the form of graphs, making it easier to find patterns and insights from large datasets.

  2. What does Anscombe's quartet demonstrate about data visualization?

    Four datasets with nearly identical summary statistics (mean, variance, correlation) can have very different distributions, which only become apparent when visualized.

  3. What Python library is used for creating static, animated, and interactive visualizations in this session?

    Matplotlib

  4. What function is used to create a simple line plot in Matplotlib?

    plt.plot(x, y)

  5. How do you change the color of a line plot?

    Use the 'color' parameter, e.g., plt.plot(x, y, color='red')

  6. How do you add a title and axis labels to a plot?

    Use plt.title('title'), plt.xlabel('x-axis'), plt.ylabel('y-axis')

  7. How do you create multiple subplots in a single figure?

    Use plt.subplot(rows, cols, index) to select the subplot, then plot normally. For example, plt.subplot(1,2,1) for the first of two subplots.

  8. What function creates a vertical bar plot?

    plt.bar(categories, values)

  9. What is the difference between a bar plot and a histogram?

    A bar plot is used for categorical data, while a histogram is used for numerical data distribution.

  10. How do you create a horizontal bar plot?

    Use plt.barh(categories, values)

  11. What function creates a scatter plot?

    plt.scatter(x, y)

  12. How do you change the size of points in a scatter plot?

    Use the 's' parameter, e.g., plt.scatter(x, y, s=200)

  13. How do you change the marker shape in a scatter plot?

    Use the 'marker' parameter, e.g., plt.scatter(x, y, marker=2)

  14. How do you change the figure size?

    Use plt.figure(figsize=(width, height)), e.g., plt.figure(figsize=(10,10))

  15. What function creates a histogram?

    plt.hist(data)

  16. How do you change the number of bins in a histogram?

    Use the 'bins' parameter, e.g., plt.hist(data, bins=30)

  17. How do you change the color of a histogram?

    Use the 'color' parameter, e.g., plt.hist(data, color='red')

  18. What function creates a box plot?

    plt.boxplot(data)

  19. What is the median represented by in a box plot?

    The line inside the box.

  20. What function creates a violin plot?

    plt.violinplot(data)

  21. How do you add a grid to a plot?

    Use plt.grid(True)

  22. How do you show median and mean lines in a violin plot?

    Use the parameters 'showmedians=True' and 'showmeans=True' in plt.violinplot()

  23. What function creates a pie chart?

    plt.pie(values, labels=labels)

  24. How do you add percentages to a pie chart?

    Use the 'autopct' parameter, e.g., plt.pie(values, autopct='%0.1f%%')

  25. How do you add a shadow to a pie chart?

    Use shadow=True, e.g., plt.pie(values, shadow=True)

  26. How do you explode (separate) a slice in a pie chart?

    Use the 'explode' parameter with a list of fractions, e.g., explode=[0,0,0,0.1] to separate the fourth slice.

  27. How do you change the colors of a pie chart?

    Use the 'colors' parameter with a list of color names, e.g., plt.pie(values, colors=['black','gray','yellow','green'])

  28. How do you create a donut plot?

    Overlay a smaller white pie chart (with plt.pie) on a larger pie chart by using a smaller radius for the inner chart.

  29. How do you add another inner circle to a donut plot (e.g., three rings)?

    Add an additional plt.pie() with an even smaller radius and a different color (e.g., blue) inside the white circle.

  30. What function creates an area plot (stacked plot) in Matplotlib?

    plt.stackplot(x, y)

  31. How do you add a line plot on top of an area plot?

    After creating the area plot with plt.stackplot(), call plt.plot(x, y) to overlay a line.

  32. How do you extract keys and values from a dictionary for plotting?

    Use list(dictionary.keys()) and list(dictionary.values()) to get lists of keys and values.

  33. How do you load the iris dataset from a CSV file in pandas?

    Use pd.read_csv('iris.csv') and assign to a variable, e.g., iris = pd.read_csv('iris.csv')

  34. How do you create a histogram from a specific column of a DataFrame?

    Use plt.hist(iris['sepal length']) after importing pandas and loading the data.

Card 1 of 34
Card 1 of 34

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent