tag:blogger.com,1999:blog-5316462986483650877.post8308491587627414598..comments2024-01-11T21:01:22.537-05:00Comments on Lunchtime Playground: Fun with Mathematica: Howto: Display 2D plot in 3DUnknownnoreply@blogger.comBlogger2125tag:blogger.com,1999:blog-5316462986483650877.post-21100797199547550092009-10-09T01:13:09.895-04:002009-10-09T01:13:09.895-04:00answering to my own post, the following patch work...answering to my own post, the following patch works with plots with arrows<br /><br />to3d[plot_, height_, opacity_] := <br /> Module[{newplot}, newplot = First@Graphics[plot]; <br /> newplot = N@newplot /. {x_?AtomQ, y_?AtomQ} -> {x, y, height} <br /> /. Arrowheads[List[List[x_, y_, notz_]]] -> <br /> Arrowheads[List[List[x, y]]];<br /> newplot /. <br /> GraphicsComplex[xx__] -> {Opacity[opacity], GraphicsComplex[xx]}];<br /><br />not very elegant but works for VectorPlot, for example<br />Show[<br /> Graphics3D[<br /> to3d[StreamPlot[{x, y}, {x, -1, 1}, {y, -1, 1}], 20, 0.75]],<br /> Graphics3D[to3d[<br /> Plot[x, {x, -1, 1}, PlotPoints -> 2],<br /> 10, 0.75]],<br /> Lighting -> "Neutral", BoxRatios -> {1, 1, 0.8}, Axes -> True]<br /><br />Thanks for the post again.AlfChttps://www.blogger.com/profile/09583505786753076063noreply@blogger.comtag:blogger.com,1999:blog-5316462986483650877.post-39911979481655717822009-10-08T22:55:39.362-04:002009-10-08T22:55:39.362-04:00great post, unfortunately it doesn't work with...great post, unfortunately it doesn't work with some plots:<br /><br />Show[<br /> Graphics3D[to3d[Plot[x, {x, -1, 1}], 30, 0.75]], <br /> Graphics3D[VectorPlot[{x, y}, {x, -1, 1}, {y, -1, 1}]],<br /> Lighting -> "Neutral", BoxRatios -> {1, 1, 0.8}, Axes -> True]<br /><br />In this case VectorPlot doesn't work, I believe it is because the arrows generated are not 3D arrows but 2D arrows that can not be interpreted by Graphics3D.AlfChttps://www.blogger.com/profile/09583505786753076063noreply@blogger.com