How To Modify 2d Scatterplot To Display Color Based Off Third Array In Csv File?
I am using Python and a CSV file. I am currently trying to modify the scatter plot(2d) below to change colors based on a third column in my csv file. After searching through multip
Solution 1:
check out the scatter line
import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as np
fig = plt.figure(figsize=(6,6))
ax = fig.add_subplot(111)
ax.set_title("X vs Y AVG",fontsize=14)
ax.set_xlabel("XAVG",fontsize=12)
ax.set_ylabel("YAVG",fontsize=12)
ax.grid(True,linestyle='-',color='0.75')
x = np.random.random(30)
y = np.random.random(30)
z = np.random.random(30)
# scatter with colormap mapping to z value
ax.scatter(x,y,s=20,c=z, marker = 'o', cmap = cm.jet );
plt.show()
and it produces
Post a Comment for "How To Modify 2d Scatterplot To Display Color Based Off Third Array In Csv File?"