Is it possible to plot a map of RGB values using Matplotlib?
I have three columns of data that I read from a text file in the following form where x and y are the desired coordinates and z is a hex string of the desired rgb color to plot at the given coordinates:
x y z
1 0.5 #000000
2 0.5 #FF0000
3 0.5 #00FF00
1 1.5 #0000FF
2 1.5 #FFFF00
3 1.5 #00FFFF
1 1.5 #FF00FF
2 2.5 #C0C0C0
3 2.5 #FFFFFF
This is my current state of code. An error is thrown from the griddata() function:
import pandas as pds
import matplotlib.pyplot as plt
# Import text file using pandas
datafile = pds.read_csv(PathToData,sep='\t')
X=datafile.x
Y=datafile.y
Z=datafile.z
# Generate mesh as 'numpy.ndarray' type for plotting
# This throws the following error:
# ValueError: could not convert string to float: #FFAA39
Z=griddata(X, Y, Z, unique(X), unique(Y))
Many thanks
imshowgiving you errors? If so what errors? If not, what is it doing (or not doing) that is different from your expectations?