'How to plot data from two dictionaries of dataframes onto one plot in python?
I have two dictionaries of dataframes that are generated from separate for loops.
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
Control_Keys = ('C1','C2','C3','C4')
Patient_Keys = ('P1','P2','P3','P4','P5','P6')
df_columns = ['Reads','Score']
C_dict = {}
P_dict = {}
# Generating dictionaries of dataframes
for i in Control_Keys:
C_dict[i] = pd.DataFrame(np.random.randint(0,100,size=(100,2)), columns=df_columns)
for i in Patient_Keys:
P_dict[i] = pd.DataFrame(np.random.randint(0,100,size=(100,2)), columns=df_columns)
I want to plot their data using the same axis on the same graph, where the x-axis is 'Reads' and the y-axis is 'Score'. I also want to be able to differentiate between the two groups, (not individual data) where all data belonging to Controls are blue, and Patients are red. I am able to plot these individually, but I have not been able to find a reliable way to merge these two graphs into one.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|