Message Boards Message Boards

0
|
5139 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Set ColorFunction in a ListPointPlot3D[]?

Posted 8 years ago

I am trying to use ListPointPlot3D to visualise some scientific data. It consists of lines of vertical columns with different heights and spacing

I have gathered the data for all columns into a single list of coordinates {x,y,z} where the x denotes which line it is in, y the position of the column and z its height

I have been able to plot it like this

Dynamic[ListPointPlot3D[res, Filling -> Bottom,   FillingStyle -> Thickness[.05]]]

This automatically colors each line a different colour.

HOWEVER I want to have control over the colour so I wrote this

col[xx_] := (If[xx > 2, Green, Blue])
Dynamic[ListPointPlot3D[res, Filling -> Bottom, 
  FillingStyle -> Thickness[.05], 
  ColorFunction -> Function[{x, y, z}, col[x]]]]

I thought that the lines where the x>2 would come out Green and the ones with x< 2 would come out Blue......Instead they all came out green ( the colour for the last line in the list.( x values ran from 1 to 4)

Why has this happened? The example given for ColorFunction in the documentation shows different parts of a plot coloured differently Is there a way to achieve what I want?

Graham

POSTED BY: graham tranfield
2 Replies

by default the colorfunction gives arguments from 0 to 1, 0 for the smallest values of your data, and 1 for the highest. This is done with the ColorFunctionScaling option, set it to False in your plot. Check the documentation it is right there:

enter image description here

POSTED BY: Sander Huisman

Thanks very much. That works brilliantly

POSTED BY: graham tranfield
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract