0
$\begingroup$

I'm trying to create a plot of values of following structure and would like to visualize its vector length as a function of colour.

{{0.993039, 0.0135508, 1.8244}, {0.993039, 0.0134245, 
  1.8244}, {0.663126, 0.0134361, 1.79733}, {0.497758, 0.0146057, 
  1.77602}, {0.497758, 0.014195, 1.77602}, {0.497758, 0.014113, 
  1.77602}, {0.497758, 0.0140746, 1.77602}, {0.497758, 0.0139925, 
  1.77602}, {0.497758, 0.0139491, 1.77602}, {0.497758, 0.0139141, 
  1.77602}, {0.497758, 0.0138091, 1.77602}, {0.497758, 0.013683, 
  1.77602}, {0.497758, 0.01359, 1.77602}, {0.497758, 0.0135753, 
  1.77602}, {0.497758, 0.0135056, 1.77602}, {0.497758, 0.0134964, 
  1.77602}, {0.497758, 0.0147068, 1.76709}, {0.497758, 0.0144276, 
  1.76709}, {0.497758, 0.0144274, 1.76709}, {0.497758, 0.014408, 
  1.76709}, {0.497758, 0.0135405, 1.76709}, {0.497758, 0.0142663, 
  1.76083}, {0.497758, 0.0141228, 1.76083}, {0.497758, 0.0140877, 
  1.76083}, {0.398405, 0.0148334, 1.74231}, {0.398405, 0.0145646, 
  1.74231}, {0.398405, 0.0139414, 1.74231}, {0.398405, 0.0149173, 
  1.73337}, {0.332114, 0.0151498, 1.72431}, {0.332114, 0.0145874, 
  1.72431}}

To achieve decent colour contrast I've hard to hard code in a Rescale step which I can hardly imagine is best practice.

cf[x_, y_, z_] := Module[{var},
  var = Rescale[EuclideanDistance[{0, 0, 0}, {x, y, z}], {1.03, 1.31}];
  ColorData["LightTemperatureMap"][var]
  ]
viewFitness[data_] := Module[{var},
  ListPointPlot3D[data,
   ImageSize -> Large,
   ColorFunction -> cf,
   Axes -> True
   ]
  ]

As I scale up the project, I won't always be able to find the min and max of the Euclidean distance of the dataset before plotting but would still like a maximal colour range for viewers. What alternative ways might this problem be addressed to provide acceptable contrast and color range for the ColorFunction?

ListPlot

$\endgroup$

1 Answer 1

1
$\begingroup$

Maybe it's better to manually construct the plot you want, while exploiting Rescale[]'s automatic scaling for lists?

data = {{0.993039, 0.0135508, 1.8244}, {0.993039, 0.0134245, 1.8244},
        {0.663126, 0.0134361, 1.79733}, {0.497758, 0.0146057, 1.77602},
        {0.497758, 0.014195, 1.77602}, {0.497758, 0.014113, 1.77602},
        {0.497758, 0.0140746, 1.77602}, {0.497758, 0.0139925, 1.77602},
        {0.497758, 0.0139491, 1.77602}, {0.497758, 0.0139141, 1.77602},
        {0.497758, 0.0138091, 1.77602}, {0.497758, 0.013683, 1.77602},
        {0.497758, 0.01359, 1.77602}, {0.497758, 0.0135753, 1.77602},
        {0.497758, 0.0135056, 1.77602}, {0.497758, 0.0134964, 1.77602},
        {0.497758, 0.0147068, 1.76709}, {0.497758, 0.0144276, 1.76709},
        {0.497758, 0.0144274, 1.76709}, {0.497758, 0.014408, 1.76709},
        {0.497758, 0.0135405, 1.76709}, {0.497758, 0.0142663, 1.76083},
        {0.497758, 0.0141228, 1.76083}, {0.497758, 0.0140877, 1.76083},
        {0.398405, 0.0148334, 1.74231}, {0.398405, 0.0145646, 1.74231},
        {0.398405, 0.0139414, 1.74231}, {0.398405, 0.0149173, 1.73337},
        {0.332114, 0.0151498, 1.72431}, {0.332114, 0.0145874, 1.72431}};

Graphics3D[{AbsolutePointSize[4],
            Transpose[{ColorData["LightTemperatureMap"] /@
                       Rescale[Norm /@ data], Point /@ data}]},
           Axes -> True, BoxRatios -> {1, 1, 0.4}]

plot with color scaling

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.