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
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