Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k points)

I just finished writing code to make a plot using pylab in Python and now I would like to superimpose a grid of 10x10 onto the scatter plot. How do I do that?

1 Answer

0 votes
by (106k points)

If you want to use pyplot.grid then you can use the below-mentioned code:-

x = numpy.arange(0, 1, 0.05) 

y = numpy.power(x, 2) 

fig = plt.figure() 

ax = fig.gca() 

ax.set_xticks(numpy.arange(0, 1, 0.1)) ax.set_yticks(numpy.arange(0, 1., 0.1)) 

plt.scatter(x, y) 

plt.grid() 

plt.show()

Related questions

0 votes
1 answer
0 votes
4 answers
0 votes
1 answer
asked Aug 16, 2020 in Data Science by blackindya (18.4k points)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...