1

I have a data set which has the following values: (X, Y, Z, R, G, B) and I want to plot these as a 3d point image.

I have done this so far

import pandas as pd
from matplotlib import pyplot as plt
import numpy as np

data = pd.read_csv('wall_data_with_headers.csv')

x = data.x
y = data.y
z = data.z
rgb = [data.red, data.green, data.blue]

fig = plt.figure()
ax = plt.axes(projection='3d')

ax.plot_trisurf(x, y, z,cmap='viridis', edgecolor='none')
ax.set_title('Surface plot')
plt.show()

Which displays the image properly, but I've got a column for RGB and I want to be able to render it per point with its corresponding RGB Value.

Output Image

  • 2
    Does this answer your question? [Specify color of each point in scatter plot (matplotlib)](https://stackoverflow.com/questions/33287156/specify-color-of-each-point-in-scatter-plot-matplotlib) – Joe Jun 23 '20 at 11:26
  • 1
    I think you have to use a scatter plot for that and not trisurf. There are also other solutions: https://www.google.com/search?q=matplotlib+scatter+rgb – Joe Jun 23 '20 at 11:27
  • 1
    And see this https://stackoverflow.com/a/57461819/7919597 – Joe Jun 23 '20 at 11:27
  • @Joe I will give these ones a try! – Christan Shane Plaza Jun 23 '20 at 14:18

0 Answers0