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.

New contributor
Nikol Š is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • 2
    triples needs { ... ... }. – Jerry 2 days ago

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

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

Your Answer

Nikol Š is a new contributor. Be nice, and check out our Code of Conduct.

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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