8
$\begingroup$

What's the easier way to plot these coincidently in 3D:

● The plane $5x - 4y - 9z = 0$
● Parametric line $x = t, y = t/2, z = t/3$
● Two points: $(0, 0, 0), (1, -1, 1)$ ?

Moreover, how can I pick a distinct colour for each and to choose the size of the points?

I tried the following, but to no avail:

aa = ContourPlot3D[
  5 x - 4 y - 9 z == 0, {x, -10, 10}, {y, -10, 10}, {z, -10, 10}, 
  AxesLabel -> {x, y, z}]     
bb = ParametricPlot3D[
  {t, t/2 t, t/3}, {t, -10, 10}, 
  PlotStyle -> RGBColor[1, 0, 1], AxesLabel -> {x, y, z}]   
cc = ListPlot3D[{0, 0, 0}, {1, -1, 1}, AxesLabel -> {x, y, z}]    
Show[aa, bb, cc]

I referenced Normal lines to surfaces or planes in a 3D plot, https://stackoverflow.com/questions/7435954/plot-plane-point-line-sphere-in-same-3d-plot-multiple-figures-in-same-plot, and http://www.math.uconn.edu/~hurley/math220/Mathematica_docs/Lines.pdf.

$\endgroup$
5
  • $\begingroup$ Try ParametricPlot3D instead of ParametricPlot $\endgroup$
    – Nasser
    Oct 15, 2013 at 5:35
  • $\begingroup$ @Nasser: Thanks. I did and updated OP. $\endgroup$
    – user9983
    Oct 15, 2013 at 5:42
  • $\begingroup$ Just as in your last question: Have you looked into the documentation regarding e.g. Point, PointSize, Color etc? $\endgroup$
    – Yves Klett
    Oct 15, 2013 at 6:11
  • $\begingroup$ try to set cc = Graphics3D[{Black, Sphere[{{0, 0, 0}, {1, -1, 1}}, .3]}] $\endgroup$
    – halmir
    Oct 15, 2013 at 6:12
  • $\begingroup$ There's a t too much in your parametric line compared to its description in text. $\endgroup$ Oct 15, 2013 at 6:34

1 Answer 1

15
$\begingroup$

There are many ways to plot planes. Note that ContourPlot3D has ContourStyle instead of PlotStyle.

a1 = ContourPlot3D[5 x - 4 y - 9 z == 0,
  {x, -10, 10}, {y, -10, 10}, {z, -10, 10}, 
  AxesLabel -> {x, y, z}, Mesh -> None, ContourStyle -> Directive[Red]];

f[x_, y_] := 1/9 (5 x - 4 y);
a2 = ParametricPlot3D[{x, y, f[x, y]},
  {x, -10, 10}, {y, -10, 10}, 
  AxesLabel -> {x, y, z}, Mesh -> None, PlotStyle -> Directive[Red]];

a3 = Graphics3D[{Red, Polygon[Flatten[#, 1] &@{#[[1]], #[[2]],f[#[[1]], #[[2]]]} & /@
   {{-10, -10}, {-10, 10}, {10, 10}, {10, -10}}]}]

There are many ways to plot lines

g[t_] := {t, t/2, t/3};
b1 = ParametricPlot3D[g[t], {t, -10, 10}, PlotStyle -> RGBColor[1, 0, 1]];
b2 = Graphics3D[{RGBColor[1, 0, 1], Line[{g[-10], g[10]}]}];

There are many ways to plot points

c1 = Graphics3D[{PointSize[Large],
    Blue, Point[{0, 0, 0}],
    Green,Point[{1, -1, 1}]}];
c2 = Graphics3D[{
    Blue, Sphere[{0, 0, 0}, 1],
    Green, Sphere[{1, -1, 1}, .5]}];
c3 = ListPointPlot3D[{{0, 0, 0}, {1, -1, 1}}];
c4 = BubbleChart3D[{{0, 0, 0, 1}, {1, -1, 1, 1}}];

All of these methods work with Show. For example,

Show[a1,b1,c1,PlotRange->{{-10,10},{-10,10},{-10,10}}]

You can check out the documentation for more styling examples.

$\endgroup$