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")
![](https://readforlearn.com/wp-content/uploads/2022/01/rVwJW.png)
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()
![](https://readforlearn.com/wp-content/uploads/2022/01/MKKNp.png)
Related Posts:
- pandas DataFrame “no numeric data to plot” error
- pandas: merge (join) two data frames on multiple columns
- How to customize a scatter matrix to see all titles?
- How to Read .txt in Pandas
- Add Legend to Seaborn point plot
- Plot pie chart and table of pandas dataframe
- Type error: cannot convert the series to
- Change figure size and figure format in matplotlib
- Add Legend to Seaborn point plot
- TypeError: ‘DataFrame’ object is not callable
- Modify the legend of pandas bar plot
- How to add title to seaborn boxplot
- How to save a Seaborn plot into a file
- Plot correlation matrix using pandas
- AttributeError: ‘Series’ object has no attribute ‘reshape’
- ImportError: No module named ‘xlrd’
- Moving Average Pandas
- Pandas dataframe groupby plot
- How to print a specific row of a pandas DataFrame?
- alueError: ordinal must be >= 1
- How to use filter, map, and reduce in Python 3
- how to sort pandas dataframe from one column
- How to iterate over rows in a DataFrame in Pandas
- How to uninstall a package installed with pip install –user
- How is Anaconda related to Python?
- FileNotFoundError: [WinError 2] The system cannot find the file specified:
- How to groupby based on two columns in pandas?
- How to correct TypeError: Unicode-objects must be encoded before hashing?
- TypeError: ‘Series’ objects are mutable, thus they cannot be hashed problemwith column
- How to install python3 version of package via pip on Ubuntu?
- ValueError: Length of values does not match length of index | Pandas DataFrame.unique()
- Save plot to image file instead of displaying it using Matplotlib
- TypeError: ‘float’ object not iterable
- Importing class from another file [duplicate]
- Pandas group-by and sum
- csv.Error: iterator should return strings, not bytes
- ‘DataFrame’ object has no attribute ‘sort’
- TypeError: method() takes 1 positional argument but 2 were given
- How can I get a list shape without using numpy?
- How to read a .xlsx file using the pandas Library in iPython?
- Changing the “tick frequency” on x or y axis in matplotlib?
- ModuleNotFoundError: No module named ‘matplotlib’
- Pandas ‘count(distinct)’ equivalent
- How can I flush the output of the print function?
- What does axis in pandas mean?
- How to add title to subplots in Matplotlib
- ‘pip3’ is not recognized as an internal or external command, operable program or batch file
- AttributeError: Can only use .dt accessor with datetimelike values
- Generate random sentences in python
- Combine two columns of text in pandas dataframe
- How to change a ‘LinearSegmentedColormap’ to a different distribution of color?
- Pandas: change data type of Series to String
- How do you use subprocess.check_output() in Python?
- Selecting with complex criteria from pandas.DataFrame
- module ‘pandas’ has no attribute ‘rolling_mean’
- List attributes of an object [duplicate]
- How can I set the aspect ratio in matplotlib?
- ValueError: unsupported pickle protocol: 3, python2 pickle can not load the file dumped by python 3 pickle?
- Convert bytes to int?
- ValueError: unsupported pickle protocol: 3, python2 pickle can not load the file dumped by python 3 pickle?
- “Initializing” variables in python?
- Difference between except: and except Exception as e:
- python SyntaxError: invalid syntax %matplotlib inline
- Count unique values per groups with Pandas [duplicate]
- How to make a histogram from a list of data
- Type error Unhashable type:set
- Linear regression with matplotlib / numpy
- Replacing a character from a certain index
- Using Look Up Tables in Python
- ValueError: Expected object or value when reading json as pandas dataframe
- ImportError: No module named ‘google’
- How to check if a column exists in Pandas
- How to put the legend out of the plot
- Matplotlib: TypeError: can’t multiply sequence by non-int of type ‘numpy.float64’
- NameError: global name ‘unicode’ is not defined – in Python 3
- TypeError: int() argument must be a string, a bytes-like object or a number, not ‘list’
- Python TypeError: non-empty format string passed to object.__format__
- how to exit a python script in an if statement
- How to do a Sigma in python 3
- environment variables PYSPARK_PYTHON and PYSPARK_DRIVER_PYTHON
- Find the unique values in a column and then sort them
- Python: urllib.error.HTTPError: HTTP Error 404: Not Found
- Why do many examples use `fig, ax = plt.subplots()` in Matplotlib/pyplot/python
- Python: Pandas pd.read_excel giving ImportError: Install xlrd >= 0.9.0 for Excel support
- Printing subscript in python
- How to clear Tkinter Canvas?
- TypeError: ‘range’ object does not support item assignment
- Must have equal len keys and value when setting with an iterable
- Meaning of list[-1] in Python
- Tkinter error: Couldn’t recognize data in image file
- How to install Openpyxl with pip
- Generate a random letter in Python
- How do I tell Matplotlib to create a second (new) plot, then later plot on the old one?
- How to convert .sav file into csv file
- ‘module’ has no attribute ‘urlencode’
- How to install PyQt4 on Windows using pip?
- How to install PyQt4 on Windows using pip?
- Convert list of dictionaries to a pandas DataFrame
- Python Pandas : pivot table with aggfunc = count unique distinct
- AttributeError: ‘Series’ object has no attribute ‘split’ error in sending emails