Answers for "python plot multiple graphs in one figure using pandas"

1

how to plot 2 graphs in same plot in matplotlib

x1 = [1, 2, 3]
Data for the first line

y1 = [4, 5, 6]

x2 = [1, 3, 5]
Data for the second line

y2 = [6, 5, 4]

plt.plot(x1, y1)
plt.plot(x2, y2)

plt.legend(["Dataset 1", "Dataset 2"])
Create a legend for the graph
Posted by: Guest on June-21-2021
0

create plots with multiple dataframes python

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

scenarios = ['scen-1', 'scen-2']

fig, ax = plt.subplots()

for index, item in enumerate(scenarios):
    df = pd.DataFrame({'A' : np.random.randn(4)})
    print df
    df.plot(ax=ax)

plt.ylabel('y-label')
plt.xlabel('x-label')
plt.title('Title')
plt.show()
Posted by: Guest on August-23-2020
2

multiple plot in one figure python

import matplotlib.pyplot as plt

plt.plot(<X AXIS VALUES HERE>, <Y AXIS VALUES HERE>, 'line type', label='label here')
plt.plot(<X AXIS VALUES HERE>, <Y AXIS VALUES HERE>, 'line type', label='label here')
plt.legend(loc='best')
plt.show()
Posted by: Guest on May-07-2020

Code answers related to "python plot multiple graphs in one figure using pandas"

Python Answers by Framework

Browse Popular Code Answers by Language