I want to read in a .csv file and draw each line as a point (x,y) with his color (r,g,b). I managed to set the points and the drawing part is fine except for the color. How can I use my variables out of my .csv file in the draw-method?

EDIT: Draw is used the way I thought it was supposed to, I got an error for no reason ( }; was too much, looks like my face when realizing my fault) and now it works (thx to percusse)



    \csvreader[head to column names]{data.csv}{}{
        \definecolor{tmpcolor}{RGB}{\r, \g, \b};
    \draw[fill=tmpcolor] (\x, \y) circle(1mm);

Important We need an intermediate step before writing color to draw because fill={rgb:red, ...} mixed all given by their ratio. So fill={rgb:red, 0;green, 0;blue, 0} triggers an arithmetic error and won't result in black color. Other ratios result in colors different to the RGB Codecolors...

closed as unclear what you're asking by Joseph Wright Jun 6 '15 at 21:07

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • The third option works for me without any problems. – percusse May 29 '14 at 11:16
  • For some curious reason it now works without changes. – Schneemannbruzzler May 29 '14 at 11:41
  • you also have an extra }; in your MWE – percusse May 29 '14 at 12:41
  • That was one the sources of the errors. Another error and its solution I have just discovered is added to my question. – Schneemannbruzzler May 29 '14 at 14:15

Browse other questions tagged or ask your own question.