'From csv, How can I plot 2 variables (P vs V) in a plot with 3rd variable (tot_r) determining the shade of the coordinate? (In python)
As in csv file below, How can I plot 2 variables (P vs V) in a plot with 3rd variable (tot_r) determining the shade of the coordinate? (In python). Total dataset is of 100,000 rows.
Thanks!!
Solution 1:[1]
From the data, looks like p, V, tot_r are all continuous. So, code below will pull the data from file data.csv and build a scatter plot as shown in attached graph
import openpyxl
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
#df = pd.read_csv("data.csv")
cmap = sns.cubehelix_palette(as_cmap=True)
f, ax = plt.subplots(figsize=(20, 5))
points = ax.scatter(df.p, df.V, c=df.tot_r, s=30, cmap=cmap)
f.colorbar(points)
Graphs output
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Redox |

