# How to plot a polygon and a line on the same graph?

I have to plot the line 1 + 4 t, 2 + 5 t, 1 + 12 t and the polygon with points {2, 3, 4}, {1, 4, 5}, {3, 3, 3} in the same graph to see if the line goes through the polygon. I was able to get them to plot separately but I cannot get them to plot together.

This is what I typed in:

pic1 = ParametricPlot3D[{1 + 4 t, 2 + 5 t, 1 + 12 t}, {t, 0, 12}];
pic2 = p = Polygon[{{2, 3, 4}, {1, 4, 5}, {3, 3, 3}}]
{Graphics3D[{Pink, p}]}
Show[pic1, pic2, PlotRange -> Automatic]


But I get the error:

Coordinate {Skeleton} should be a triple of numbers, or a Scaled form.

How do I fix this?

• you probably just have a simple syntax error, is that what you want: pic1 = ParametricPlot3D[{1 + 4 t, 2 + 5 t, 1 + 12 t}, {t, 0, 1}]; p = Polygon[{{2, 3, 4}, {1, 4, 5}, {3, 3, 3}}] ; pic2 = {Graphics3D[{Pink, p}]}; Show[pic1, pic2, PlotRange -> Automatic] – Pinguin Dirk Sep 15 '13 at 17:26
• Thank you! This worked perfectly! – guest Sep 15 '13 at 20:57

Besides the syntax error, your main problem is with your plot range. The following will work.

pic1 = ParametricPlot3D[{1 + 4 t, 2 + 5 t, 1 + 12 t}, {t, 0, 12}];
pic2 = Graphics3D[{Pink, Polygon[{{2, 3, 4}, {1, 4, 5}, {3, 3, 3}}]}];
Show[pic1, pic2,
Lighting -> {{"Ambient", White}},
PlotRange -> {{1, 5}, {2, 7}, {1, 13}}] I also set the plot's lighting so that your pink triangle would appear in its true color.

### Edit

The OP requests that the points {1, 2, 1} and {5, 7, 12} appear in the plot. I have modified the plot range to include these points.

• How would I make the points (1,2,1) and (5,7,13) also appear on the graph? They are part of the line. – guest Sep 15 '13 at 21:03