Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to remove grid lines on image in python?

I am using google colab for my project. I am getting grid lines on images even I am not writing them.

from matplotlib import pyplot as plt
%matplotlib inline
import cv2

img = cv2.imread('k15.jpg')

img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

plt.imshow(img)

enter image description here

for code like above, I am getting grid lines which is not the case when I run the same code in my python shell.

like image 858
Karan Purohit Avatar asked May 26 '18 14:05

Karan Purohit


People also ask

How do I get rid of gridlines in Seaborn?

To get rid of gridlines, use grid=False. To display the figure, use show() method.

What does PLT grid () do in Python?

grid() Function. The grid() function in pyplot module of matplotlib library is used to configure the grid lines.

How to draw grid lines on an image in Python?

The grid lines are drawn onto the image using the grid () method. The grid () method takes several parameters: which – It refers to the grid lines to apply the changes on (Here we are using major).

Is it possible to turn off grid lines on a notebook?

In any case it should be possible to manually turn the grid lines off on a per notebook basis. %matplotlib inline from matplotlib import pyplot as plt plt.rcParams ["axes.grid"] = False # rest of code That's finally solved my problem.

How to add grid lines to matplotlib plot?

Matplotlib Adding Grid Lines 1 Add Grid Lines to a Plot. With Pyplot, you can use the grid () function to add grid lines to the plot. 2 Specify Which Grid Lines to Display. You can use the axis parameter in the grid () function to specify which grid lines to display. ... 3 Set Line Properties for the Grid. ...

How to remove gridlines in ggplot2?

How to Remove Gridlines in ggplot2 (With Examples) The easiest way to remove gridlines in ggplot2 is to use theme_classic() : ggplot(df, aes (x=x, y=y)) + geom_point() + theme_classic()


1 Answers

plt.imshow(myImage)
plt.grid(None)   <---- this should remove that white grid
like image 186
kawingkelvin Avatar answered Oct 19 '22 16:10

kawingkelvin