TransWikia.com

3D plot from an array

Mathematica Asked on July 21, 2021

I have an array on the following form:

Array[1, {4, 4, 3}];

and i want to visualise the data in 3D plot, i tried many times but usually Mathematica reply that there is an error.

here is a part of the code

 NNN = 4;
curvesV = Array[1, {NNN, NNN, 3}];
(*curvesOC=Array[l,{1001,13}];*)
[Tau] = T;
For[l = 1, l <= NNN, l++,
 {V = l - 1;
  For[ll = 1, ll <= NNN, ll++,
   {Subscript[[CapitalOmega], c] = ll - 1;
    curvesV[[l, ll, 1]] = V;
    curvesV[[l, ll, 2]] = Subscript[[CapitalOmega], c];
    (*Print[curvesV[[l,ll,1]]];
    Print[curvesV[[l,ll,2]]];*)
    
    Sol[t_] = 
     NDSolve[Eq, A, {t, 0, T}, MaxSteps -> 10^7, AccuracyGoal ->10];
    Subscript[[CapitalRho], 66] = 
     Abs[[Rho][6][6][[Tau]]] /. Sol[[Tau]];
    curvesV[[l, ll, 3]] = Abs[Subscript[[CapitalRho], 66]]^2;
    }]}]
curvesV
DRF = Flatten[curvesV, 1];
ListPlot3D[curvesV]
ListSliceContourPlot3D[curvesV]
ListContourPlot3D[curvesV]
ListPlot3D[DRF]
ListSliceContourPlot3D[DRF]
ListContourPlot3D[DRF]

part of the data

{{{0, 0, {0.20667}}, {0, 1, {0.584291}}, {0, 2, {0.948858}}, {0,3, {0.922532}}}, {{1, 0, {0.20667}}, {1, 1, {0.188105}}, {1,2, {0.000314782}}, {1, 3, {0.163525}}}, {{2, 0, {0.20667}}, {2,1, {0.948938}}, {2, 2, {0.0784778}}, {2, 3, {0.00361825}}}, {{3,0, {0.20667}}, {3, 1, {0.772576}}, {3, 2, {0.466603}}, {3,3, {0.00774734}}}}

2 Answers

Edit

data = {{{0, 0, {0.20667}}, {0, 1, {0.584291}}, {0, 
     2, {0.948858}}, {0, 3, {0.922532}}}, {{1, 0, {0.20667}}, {1, 
     1, {0.188105}}, {1, 2, {0.000314782}}, {1, 3, {0.163525}}}, {{2, 
     0, {0.20667}}, {2, 1, {0.948938}}, {2, 2, {0.0784778}}, {2, 
     3, {0.00361825}}}, {{3, 0, {0.20667}}, {3, 1, {0.772576}}, {3, 
     2, {0.466603}}, {3, 3, {0.00774734}}}};
newdata = Flatten /@ Flatten[data, 1]
ListPlot3D[newdata]

enter image description here

Original

Depend on the structure of your data. Maybe this

data = RandomReal[1, {20, 20, 3}]; 
ListSliceContourPlot3D[data]
ListContourPlot3D[data]

Correct answer by cvgmt on July 21, 2021

This is a data structure appearing in RGBColor

Graphics[{Pink, Disk[{100, 100}, 40], 
  Raster[RandomReal[1, {200, 200, 4}], ColorFunction -> RGBColor]}]

Raster

And in Raster3D:

Graphics3D[{Raster3D[RandomReal[1, {5, 5, 5}]]}]

Graphics3D[{Raster3D[RandomReal[1, {5, 5, 5}]]}]

Graphics3D[{Opacity[.5], Raster3D[RandomReal[1, {5, 5, 5, 3}]]}]

Graphics3D[{Opacity[.5], Raster3D[RandomReal[1, {5, 5, 5, 3}]]}]

I am sorry Your code snippet is incomplete and can not run successful.

Head@curvesV

(* List *)

Head /@ curvesV

(* {List, List, List, List} *)

Dimensions@curvesV (* {4, 4, 3} *)

First@curvesV

(* {{0, 0, Abs[ Abs[[Rho][6][6][T]] /. NDSolve[Eq, A, {T, 0, T}, MaxSteps -> 10000000, AccuracyGoal -> 10]]^2}, {0, 1, Abs[Abs[[Rho][6][6][T]] /. NDSolve[Eq, A, {T, 0, T}, MaxSteps -> 10000000, AccuracyGoal -> 10]]^2}, {0, 2, Abs[Abs[[Rho][6][6][T]] /. NDSolve[Eq, A, {T, 0, T}, MaxSteps -> 10000000, AccuracyGoal -> 10]]^2}, {0, 3, Abs[Abs[[Rho][6][6][T]] /. NDSolve[Eq, A, {T, 0, T}, MaxSteps -> 10000000, AccuracyGoal -> 10]]^2}} *)

First@Array[1, {4, 4, 3}]
{{1[1, 1, 1], 1[1, 1, 2], 1[1, 1, 3]}, {1[1, 2, 1], 1[1, 2, 2], 
  1[1, 2, 3]}, {1[1, 3, 1], 1[1, 3, 2], 1[1, 3, 3]}, {1[1, 4, 1], 
  1[1, 4, 2], 1[1, 4, 3]}}

Graphics[{Pink, Disk[{100, 100}, 40], 
  Raster[Array[1, {200, 200, 4}], ColorFunction -> RGBColor]}]

fails because it expects more values than only 1s.

This works because of the attributes of the evaluation of the representation built-ins.

Answered by Steffen Jaeschke on July 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP