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)
for code like above, I am getting grid lines which is not the case when I run the same code in my python shell.
To get rid of gridlines, use grid=False. To display the figure, use show() method.
grid() Function. The grid() function in pyplot module of matplotlib library is used to configure the grid lines.
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).
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.
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 (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()
plt.imshow(myImage)
plt.grid(None) <---- this should remove that white grid
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With