Question

Write a simple Python code to draw a line (y=10x). The plot should have the following...

Write a simple Python code to draw a line (y=10x). The plot should have the following labels in the x-axis, y-axis, and a title.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

code:

import matplotlib.pyplot as plt
plt.style.use('seaborn-whitegrid')
import numpy as np

fig = plt.figure()
ax = plt.axes()

#setting labels and title
plt.xlabel("X axis")
plt.ylabel("Y axis")
plt.title("Y = 10X")

#generating liner space for x values
x = np.linspace(-1, 10, 1000)

#plotting x values and corresponding y values
ax.plot(x, 10*x,label="y = 10x");
ax.legend()

Add a comment
Know the answer?
Add Answer to:
Write a simple Python code to draw a line (y=10x). The plot should have the following...
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
  • two functions. The first plot on the left is y = 1 − e(−0.5sqrt(x) and the...

    two functions. The first plot on the left is y = 1 − e(−0.5sqrt(x) and the second plot on the right is y = e(−0.5sqrt(x) . Let x be from 0 to 10 with increment 0.1. The first plot is in blue color, solid line and the second is in red color, dotted line. Turn both grids on. Both figures should have own title and x-axis and “y-axis” labels. Note that you should plot both according to the above instruction....

  • 2) Write a Python program that draw simple lollipop (a line and few circles, the line should atta...

    2) Write a Python program that draw simple lollipop (a line and few circles, the line should attach to the circles, just as regular lollipop, you decide the colors), just as we make a "dart" for assignment. You can use the same idea when we make "target" by making few circles with different colors, and using mouse click get 2 points to draw a line. See sample program from Zelle textbook, chapter 4, click.pyw and triangle.pyw. Or see assignment archery.pyw....

  • Draw typical reflectance curves of healthy vegetation, clear water, moist soil on the same plot. (y-axis...

    Draw typical reflectance curves of healthy vegetation, clear water, moist soil on the same plot. (y-axis uses unit: reflectance in percentage, x-axis use wavelength ranging from 0.4-2.4 micrometer). Note: the plot requires proper labels (with the unit), x-y axes, legend, and title.

  • (ON PYTHON IDLE 3.7.2) Write a code to draw the following pattern: Write a code to draw the following pattern:

    (ON PYTHON IDLE 3.7.2) Write a code to draw the following pattern: Write a code to draw the following pattern:

  • Write the PYTHON code that displays the following numbers: The program should have a header that...

    Write the PYTHON code that displays the following numbers: The program should have a header that displays "Number   Doubled Tripled" above the start of the numbers. If putting all numbers on the same line, then they will need to be separated so you can see he individual number.(https://www.programiz.com/python-programming/methods/built-in/print) The program should display Every whole number from 1 through 35. The program should display that number doubled. The program should also display that number tripled. Make a working version of this...

  • Please write simple python code of y''+2y'-3y = 0, y(0) = 2, y'(0)=1 with modified euler...

    Please write simple python code of y''+2y'-3y = 0, y(0) = 2, y'(0)=1 with modified euler method and 4th order Runge-Kutta Kutta method

  • Python: We defined two variables, x = 'Python' and y = '3.0'. Write code to concatenate...

    Python: We defined two variables, x = 'Python' and y = '3.0'. Write code to concatenate the two numbers (the result should be 'Python3.0').

  • Python Programming language. Complete the problems below using Jupyter Notebook. Problem Needs to be solved from...

    Python Programming language. Complete the problems below using Jupyter Notebook. Problem Needs to be solved from number #1 link provided for the Data: -----> https://docs.google.com/spreadsheets/d/1TqhyxFKQlOHAyXpQBL-4C96kgZFBoMwUgE8-b33CqPQ/edit?usp=sharing PROBLEMS # 0.0 Import the libraries (pandas, matplotlib, and seaborn) Include the code line: %matplotlib inline #Include the code line: plt.style.use(“ggplot”) #Load the data using pandas #Inspect the data using head(), dtypes ANSWERD: import pandas as pd import matplotlib.pyplot as plt import seaborn as sns plt.style.use('ggplot') %matplotlib inline df = pd.read_csv() print(df.head()) print(df.dtypes) # 1...

  • Write a Python Program What should the values of X and Y be, so that the...

    Write a Python Program What should the values of X and Y be, so that the following code prints the 'd' found inside one of the elements of alist? alist = [['47a','47b'],'47c','47d',[['47e','47f'],'47g']] print(alist[X][Y]) Then write another print(...) statement that prints the the 'b' inside of alist, by indexing again into to its specific location within alist.

  • Please write the following code as simple as possible in python: You will need to define...

    Please write the following code as simple as possible in python: You will need to define a function with four arguments. Here is what I used: > def find_matches(file1.txt, output1.txt, strings, value): file1.txt will contain a list of various strings. The program must copy from the first argument, and it should be written in the second argument (the second file, "output1.txt"). The third and fourth arguments will determine which specific strings will be copied over to the second file. For...

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