Halloween Sale: Flat 70% + Addl. 25% Off + 30 Days Extra Lab on all Courses | Use Coupon HS25 in Checkout | Offer Expires In

  Enroll Now

Getting Stared with Matplotlib - Create a Scatter Plot using Pyplot

Scatter plots show how much one variable is affected by another. The relationship between two variables is called their correlation.

INSTRUCTIONS
  • Import pyplot

    import matplotlib.<< your code goes here >> as plt
    
  • Import rand to generate random values for the x-, and y-coordinates

    from numpy.random import << your code goes here >>
    
  • Now we will call the scatter module to generate the scatter plot.

    for color in ['red', 'green', 'blue']:
        n = 100
        x, y = rand(2, n)
        scale = 500.0 * rand(n) ** 5
        plt.<< your code goes here >>(x, y, s=scale, c=color, alpha=0.3, edgecolors='blue')
    
    plt.grid(True)
    plt.show()
    

    Here, s is a scalar or array-like shape, and is an option argument. c defines the color. alpha defines the alpha blending value, or the transparency. edgecolor is the line color of the shapes. grid displays the plot grid.


No hints are availble for this assesment

Answer is not availble for this assesment


Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...