Get Rid of Grid Lines When Plotting with Seaborn and Pandas



To get rid of grid lines when plotting with Pandas with secondary_y, we can take the following steps −

  • Create a data frame using DataFrame wth keys column1 and column2.

  • Use data frame data to plot the data frame. To get rid of gridlines, use grid=False.

  • To display the figure, use show() method.

Example

import pandas as pd
from matplotlib import pyplot as plt
plt.rcParams["figure.figsize"] = [7.00, 3.50]
plt.rcParams["figure.autolayout"] = True
data = pd.DataFrame({"column1": [4, 6, 7, 1, 8], "column2": [1, 5, 7, 8, 1]})
data.plot(secondary_y=[5], grid=False)
plt.show()

Output

Updated on: 2021-05-06T13:17:02+05:30

4K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements