Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error **matplotlib: plot multiple columns of pandas data frame on the bar chart** **in python**. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

Table of Contents

## How matplotlib: plot multiple columns of pandas data frame on the bar chart Error Occurs?

Today I get the following error **matplotlib: plot multiple columns of pandas data frame on the bar chart** **in python**.

## How To Solve matplotlib: plot multiple columns of pandas data frame on the bar chart Error ?

**How To Solve matplotlib: plot multiple columns of pandas data frame on the bar chart Error ?**To Solve matplotlib: plot multiple columns of pandas data frame on the bar chart Error You can plot several columns at once by supplying a list of column names to the

`plot`

's`y`

argument.**matplotlib: plot multiple columns of pandas data frame on the bar chart**To Solve matplotlib: plot multiple columns of pandas data frame on the bar chart Error You can plot several columns at once by supplying a list of column names to the

`plot`

's`y`

argument.

## Solution 1

Although the accepted answer works fine, since v0.21.0rc1 it gives a warning

UserWarning: Pandas doesn’t allow columns to be created via a new attribute name

Instead, one can do

df[["X", "A", "B", "C"]].plot(x="X", kind="bar")

## Solution 2

You can plot several columns at once by supplying a list of column names to the `plot`

‘s `y`

argument.

df.plot(x="X", y=["A", "B", "C"], kind="bar")

This will produce a graph where bars are sitting next to each other.

In order to have them overlapping, you would need to call `plot`

several times, and supplying the axes to plot to as an argument `ax`

to the plot.

import pandas as pd import matplotlib.pyplot as plt import numpy as np y = np.random.rand(10,4) y[:,0]= np.arange(10) df = pd.DataFrame(y, columns=["X", "A", "B", "C"]) ax = df.plot(x="X", y="A", kind="bar") df.plot(x="X", y="B", kind="bar", ax=ax, color="C2") df.plot(x="X", y="C", kind="bar", ax=ax, color="C3") plt.show()

**Summery**

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

**Also, Read**