Re: Putting a Plot inside a Graphics function with other
- To: mathgroup at smc.vnet.net
- Subject: [mg108114] Re: [mg108071] Putting a Plot inside a Graphics function with other
- From: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>
- Date: Mon, 8 Mar 2010 06:17:19 -0500 (EST)
Hi, Ram, Show does the job. Use it as follows: Show[{Plot[whatever], Graphics@Disk[whatever]}] This is a trivial combination, but this same way one may easily make more complex useful things. Please have a look at the example of a drawing below. It basically consists of a number of definitions of elements including some graphs and primitives that are then combined together by Show the same way as in your case. The image shows schematically a cylindrical magnet with magnetic field lines and an object subjected to magnetic field: cyl = Graphics3D[{Green, Specularity[Yellow, 30], Opacity[0.8], Cylinder[{{0, 0, 0}, {0, 0, 2}}, 0.5]}]; ses = Graphics3D[Cuboid[{{-1, -1, 3}, {1, 1, 3.1}}]]; lin1 = Graphics3D[{Thick, Blue, Line[{{-0.5, 0, -0.35}, {0.5, 0, -0.35}}]}]; cone1 = Graphics3D[{LightBlue, Cone[{{-0.3, 0, -0.35}, {-0.5, 0, -0.35}}, 0.05]}]; cone2 = Graphics3D[{LightBlue, Cone[{{0.3, 0, -0.35}, {0.5, 0, -0.35}}, 0.05]}]; txt1 = Graphics3D[Text[Style["2r", 18, Italic], {0, 0, -0.5}]]; lin2 = Graphics3D[{Thick, Blue, Line[{{0.7, 0, 0.}, {0.7, 0, 2}}]}]; cone3 = Graphics3D[{LightBlue, Cone[{{0.7, 0, 0.2}, {0.7, 0, 0.}}, 0.05]}]; cone4 = Graphics3D[{LightBlue, Cone[{{0.7, 0, 1.8}, {0.7, 0, 2}}, 0.05]}]; txt2 = Graphics3D[Text[Style["L", 18, Italic], {0.8, 0, 1}]]; lin3 = Graphics3D[{Thick, Blue, Line[{{0., 0, 2.}, {0., 0, 3}}]}]; cone5 = Graphics3D[{LightBlue, Cone[{{0., 0, 2.2}, {0., 0, 2.}}, 0.05]}]; cone6 = Graphics3D[{LightBlue, Cone[{{0., 0, 2.8}, {0., 0, 3}}, 0.05]}]; txt3 = Graphics3D[Text[Style["z", 18, Italic], {0.15, 0, 2.5}]]; pl1 = Table[ ParametricPlot3D[{Cos[\[CurlyPhi]]*0.1*Cosh[(u - 1)], Sin[\[CurlyPhi]]*0.1*Cosh[(u - 1)], u}, {u, -2, 3.5}, PlotStyle -> {Green, Thickness[0.005]}], {\[CurlyPhi], 0, 2 \[Pi], \[Pi]/3}]; arr1 = Table[ Graphics3D[{Green, Cone[{{Cos[\[CurlyPhi]]*0.1*Cosh[(2.3)], Sin[\[CurlyPhi]]*0.1*Cosh[(2.3)], 3.3}, {Cos[\[CurlyPhi]]*0.1*Cosh[(2.1)], Sin[\[CurlyPhi]]*0.1*Cosh[(2.1)], 3.1}}, 0.05]}], {\[CurlyPhi], 0, 2 \[Pi], \[Pi]/3}]; arr2 = Table[ Graphics3D[{Green, Cone[{{Cos[\[CurlyPhi]]*0.1*Cosh[-2.6], Sin[\[CurlyPhi]]*0.1*Cosh[-2.6], -1.6}, {Cos[\[CurlyPhi]]*0.1* Cosh[-2.8], Sin[\[CurlyPhi]]*0.1*Cosh[-2.8], -1.8}}, 0.05]}], {\[CurlyPhi], 0, 2 \[Pi], \[Pi]/3}]; Manipulate[ Show[{cyl, ses, lin1, cone1, cone2, txt1, lin2, cone3, cone4, txt2, lin3, cone5, cone6, txt3, pl1, arr1, arr2}, Boxed -> False, ViewPoint -> {5*Cos[\[Phi]]*Sin[\[Theta]], -3*Sin[\[Phi]]* Sin[\[Theta]], Cos[\[Theta]]}], {{\[Phi], 1.49}, 0, 2 \[Pi]}, {{\[Theta], 0.78}, 0, \[Pi]}, Paneled -> False] Have fun, Alexei Hello, (Please ignore my earlier question about plot markers, I already figured it out, thanks.) I am trying to combine a Plot with other graphics elements. I've tried doing Graphics[{Plot[whatever], Disk[whatever]}], but it's saying that "Graphics is not a Graphics directive." (Probably because Plot already applies Graphics itself.) How do I do this? Thanks for your time, Ram Rachum -- Alexei Boulbitch, Dr., habil. Senior Scientist IEE S.A. ZAE Weiergewan 11, rue Edmond Reuter L-5326 Contern Luxembourg Phone: +352 2454 2566 Fax: +352 2454 3566 Website: www.iee.lu This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you are not the intended recipient and have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal from your system. Thank you for your co-operation.