0
$\begingroup$

I am having troubles with plotting this set of data

triples={{0, 1, 1}, {9/50, 4/5, 1}}, {{9/50, 4/5, 1}, {3/8, 4/5, 1}}, {{3/8, 58333/100000, 1}, {3/4, 16667/100000, 1}}, {{3/4, 0, 1}, {1, 0, 1}}, {{0, 1, 2}, {27/100, 4/5, 2}}, {{27/100, 4/5, 2}, {9/16, 4/5, 2}}, {{9/16, 0, 2}, {1, 0, 2}}, {{0, 1, 3}, {81/200, 4/5, 3}}, {{81/200, 4/5, 3}, {21/32, 4/5, 3}}, {{21/32, 0, 3}, {1, 0, 3}}, {{0, 1, 4}, {243/400, 4/5, 4}}, {{243/400, 0, 4}, {1, 0, 4}},{{0, 1, 5}, {471/800, 43539/50000, 5}}, {{471/800, 0, 5}, {1, 0, 5}}

At first I had pairs of points, after I added the third coordinate to be able to plot it in 3D, but the problem now is I cant plot it, because every iteration is given by piecewise linear part, by intervals. I would like to get 3D plot from this set of points, where every coordinate z is one iteration.

For plotting I use this

Show[ListPointPlot3D[triples, AxesLabel -> {x, y, z}, PlotRange -> {{0, 1}, {0, 1}, {0, 5}}, ColorFunction -> "Rainbow", BoxRatios -> {1, 1, 2}], Graphics3D[Line[triples]]]

but it gives me error: >The specified setting for the option Graphics3DBoxOptions, PlotRange cannot be used.

Any suggestions would be greatly appreciated.

$\endgroup$
1
  • 2
    $\begingroup$ triples needs { ... ... }. $\endgroup$
    – Jerry
    Dec 8, 2018 at 9:46

2 Answers 2

0
$\begingroup$
triples = {{{0, 1, 1}, {9/50, 4/5, 1}}, {{9/50, 4/5, 1}, {3/8, 4/5, 
     1}}, {{3/8, 58333/100000, 1}, {3/4, 16667/100000, 1}}, {{3/4, 0, 1}, {1, 
     0, 1}}, {{0, 1, 2}, {27/100, 4/5, 2}}, {{27/100, 4/5, 2}, {9/16, 4/5, 
     2}}, {{9/16, 0, 2}, {1, 0, 2}}, {{0, 1, 3}, {81/200, 4/5, 3}}, {{81/200, 
     4/5, 3}, {21/32, 4/5, 3}}, {{21/32, 0, 3}, {1, 0, 3}}, {{0, 1, 
     4}, {243/400, 4/5, 4}}, {{243/400, 0, 4}, {1, 0, 4}}, {{0, 1, 
     5}, {471/800, 43539/50000, 5}}, {{471/800, 0, 5}, {1, 0, 5}}};

Assuming that you want the lines to be discontinuous.

{zmin, zmax} = MinMax@Flatten[triples, 1][[All, 3]]

(* {1, 5} *)

Show[
 ListPointPlot3D[triples,
  AxesLabel -> (Style[#, 14, Bold] & /@ {x, y, z}),
  PlotRange -> {{0, 1}, {0, 1}, {0, 5}},
  PlotStyle -> PointSize[Large],
  ColorFunction -> "Rainbow",
  BoxRatios -> {1, 1, 2}],
 Graphics3D[{Thick, {ColorData["Rainbow"][
       Rescale[Mean[#[[All, 3]]], {zmin, zmax}]], Line[#]} & /@ triples}]]

enter image description here

$\endgroup$
0
$\begingroup$

tiples is not a List. Maybe you made a mistake when copied here. Add brackets around,

triples = {{{0, 1, 1}, {9/50, 4/5, 1}}, {{9/50, 4/5, 1}, {3/8, 4/5, 
     1}}, {{3/8, 58333/100000, 1}, {3/4, 16667/100000, 1}}, {{3/4, 0, 
     1}, {1, 0, 1}}, {{0, 1, 2}, {27/100, 4/5, 2}}, {{27/100, 4/5, 
     2}, {9/16, 4/5, 2}}, {{9/16, 0, 2}, {1, 0, 2}}, {{0, 1, 
     3}, {81/200, 4/5, 3}}, {{81/200, 4/5, 3}, {21/32, 4/5, 
     3}}, {{21/32, 0, 3}, {1, 0, 3}}, {{0, 1, 4}, {243/400, 4/5, 
     4}}, {{243/400, 0, 4}, {1, 0, 4}}, {{0, 1, 5}, {471/800, 
     43539/50000, 5}}, {{471/800, 0, 5}, {1, 0, 5}}};

then use Flatten[triples,1] to get a List of 3D points.

Show[ListPointPlot3D[Flatten[triples, 1], AxesLabel -> {x, y, z}, 
  PlotRange -> {{0, 1}, {0, 1}, {0, 5}}, ColorFunction -> "Rainbow", 
  BoxRatios -> {1, 1, 2}], Graphics3D[Line[Flatten[triples, 1]]]]

fig1

$\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.