Question

python 3.7 please help what command do I use to make a scatterpot in python?

python 3.7 please help

what command do I use to make a scatterpot in python?
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution : To implement a scatterplot in python , we can use the matplotlib library. Matplotlib has a built in function to create scatterplots called scatter(). A scatter plot shows the data as a collection of points. We use matplotlib.show() to see the output.

Code :

import matplotlib.pyplot as plt

a = [4,6,7,6,1,15,2,7,5,12,13,7,5] #data for x-axis
b = [95,81,82,83,106,81,104,82,89,73,72,80,81] #data for y-axis

plt.scatter(a, b)
plt.show()

Output :

For random data distributions :

We use numpy.random.normal() function which is of the format :

numpy.random.normal(mean,standard deviation, random numbers)

Code :

import numpy as np
import matplotlib.pyplot as plt

a = np.random.normal(8.0, 3.0, 500) #random data
b = np.random.normal(10.0, 6.0, 500) #random data

plt.scatter(a, b)
plt.show()

Output :

Add a comment
Know the answer?
Add Answer to:
python 3.7 please help what command do I use to make a scatterpot in python?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • code that I started: # THIS IS NEEDED TO USE ARRAYS IN PYTHON: from array import * # THIS IS NEEDED TO MAKE PLOTS IN PY...

    code that I started: # THIS IS NEEDED TO USE ARRAYS IN PYTHON: from array import * # THIS IS NEEDED TO MAKE PLOTS IN PYTHON: import matplotlib.pyplot as plt # IMPORT A ROUTINE FROM NUMPY USEFUL FOR CREATING AN # ARRAY FILLED WITH ZEROS from numpy import zeros # THIS COMMAND CREATES AN ARRAY OF ZEROS WITH DESIRED SHAPE: V=zeros([31,21]) newV=zeros([31,21]) # SET UP THE BOUNDARY VALUES: V=8 ON TOP OF BOX iy=20 for ix in range(0,31): V[ix,iy]=8.0 #...

  • Use matplotlib to make a cycloid Please use python

    Use matplotlib to make a cycloid Please use python

  • Python 3. Help please. Here is my current code. What can I do to fix it?...

    Python 3. Help please. Here is my current code. What can I do to fix it? I list=[1,2,2,3,4,5] d = {} for item in list: if item in d: return True d[item] = True return False Exercise 11.4. If you did Exercise 10.7, you already have a function named has_duplicates that takes a list as a parameter and returns True if there is any object that appears more than once in the list. Use a dictionary to write a faster,...

  • This is for Linux. Use the command df. What do you see? 17. Use the command...

    This is for Linux. Use the command df. What do you see? 17. Use the command du /usr | more. What do you see? 18. What is the command fsck used for? 19. What is the command quotacheck, quotaon, edquota and repquota used for? 20. What is the command quota used for?

  • Linux 13. Use the command: set | less. What does the set command do? 14. What...

    Linux 13. Use the command: set | less. What does the set command do? 14. What is the purpose of the variables: PS1, HOME, PWD, PATH? 15. Use the command: echo $PS1. Why did you have to use the dollar sign with the variable name? What did it do? 16. Use the command: PS1="This is my new prompt: #". What did it do?

  • # python making a list of numbers i want to use python to make a list...

    # python making a list of numbers i want to use python to make a list of numbers like this A = [2,2,4,4,6,6,8,8,10,10.....................48,48,50,50] # it should be a total of 50 numbers long and contain 2 of each even number

  • Hello, I would greatly appreciate it if anyone could help me. I saved a text file...

    Hello, I would greatly appreciate it if anyone could help me. I saved a text file in the C drive of my computer. I need to use open the text file to do my homework. But when I used the Python 3.7 to open the file, I got error message: NO SUCH FILE OR DIRECTORY. What should I do to open the file using the Python. Many thanks for your help.

  • Please I wish you use Python 3.7 for this problems. Q1. Write a program that receives...

    Please I wish you use Python 3.7 for this problems. Q1. Write a program that receives a series of numbers from the user and allows the user to press the enter key to indicate that he or she is finished providing inputs. After the user presses the enter key, the program should print the sum of the numbers and their average. Q2. The credit plan at TidBit Computer Store specifies a 10% down payment and an annual interest rate of...

  • Hi I need assistance getting rid of the ugly line and this is python 3.7 Please...

    Hi I need assistance getting rid of the ugly line and this is python 3.7 Please explain how you fixed this ! File Edit Format View Help 4.1.14 in the profitPlot function in the text, fix the problem raised by reflection 4.15 Reflection: when you run this plotting program, you wil1 notice an ugly line from the origin to the first point of the plot. How can you fix this? import turtle def profitPlot(tortoise, maxPrice): for price in range(1,2 maxPrice+1):...

  • PYTHON I need help with this Python problem, please follow all the rules! Please help! THANK...

    PYTHON I need help with this Python problem, please follow all the rules! Please help! THANK YOU! Bonus Question Implement an efficient algorithm (Python code) for finding the 11th largest element in a list of size n. Assume that n will be greater than 11. det find 11th largest numberlissy Given, lissy, a list of n integers, the above function will return the 11th largest integer from lissy You can assume that length of lissy will be greater than 11....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT