I was reading this and I don't understand what is happening at page 16. What does it mean to have Abs[Round[10#1]&] after ColorData? What do they code for and what are their arguments?

  • $\begingroup$ The documentation for ColorFunction tells you what the arguments are for the different types of plots. For Plot3D the notional arguments are x, y, z. This is also shown in the documentation for Plot3D. #1 or just # refers to the first argument, i.e., notional x. $\endgroup$ – Bob Hanlon Apr 4 at 15:13
  • $\begingroup$ Yes, what I don't understand is what numbers Abs , which as far as I understand gives the absolute value of a complex number, is referring to here. Also Round[x] should give the integer closest to $x$, which here is maybe represented by #1, but I don't see what 10 stands for or either & at the end. $\endgroup$ – Cat Apr 4 at 15:24
  • 2
    $\begingroup$ The ColorFunction assigns a color to each {x, y, z}point used in the plot. In this specific case, it is only using the first coordinate to determine the color. It multiplies the first coordinate by 10, rounds the product, and takes the absolute value of the rounded value. This is then the argument to the specified ColorData color scheme. Since the ColorFunctionScaling is False it is using the raw {x, y, z} values rather than scaling each coordinate to the interval {0, 1}. Abs also works on real numbers. Abs[-10] is 10 $\endgroup$ – Bob Hanlon Apr 4 at 15:36
  • $\begingroup$ Thanks, now it’s perfectly clear. If you want, you can turn this comment into an answer, so that I can accept it $\endgroup$ – Cat Apr 4 at 17:16
  • $\begingroup$ Feel free to answer your own question. $\endgroup$ – Bob Hanlon Apr 4 at 17:22

Browse other questions tagged or ask your own question.