I am using Python and a CSV file. I am currently trying to change the scatter plot (2d) below to change colors based on the third column in my csv file. After searching through several posts, I basically want to use a common color palette (rainbow) and multiply my third array by colormap to display different colors for each of the xy points. I think I can do everything from the ax.scatter
function, but I'm not sure how to multiply each other x, y coordinate by the color map and the number of the third array. It should look like a contour plot, but I would prefer a different color scatter plot.
Here is the code I'm using:
import matplotlib from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from matplotlib.figure import Figure import matplotlib.mlab as mlab import numpy as np r = mlab.csv2rec('test.csv') fig = Figure(figsize=(6,6)) canvas = FigureCanvas(fig) 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 = r.xavg
Jonny source share