1
$\begingroup$

I am trying to put these two graphs together but and getting the shown error:

    p1=ContourPlot3D[z-y==3,{x,-2,2},{y,-4,4},{z,0,6},
RegionFunction->Function[{x,y,z},4x^2+y^2<=9],
PlotRange->{0,6.5},
ColorFunction->DarkRainbow]
axes1=ParametricPlot3D[{{t/2,0,0},
{0,t/2,0},
{0,0,t}},
{t,0,6},
PlotRange->{{0,3},{0,.5}{0,6}}]
a2=axes1/.Line[x_]:>{Arrowheads[{0.05}],Arrow[x]}
Show[P1,a2]

Error:

[error message1

Any help would be appreciated

New contributor
GeorgeE is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$
1
  • 5
    $\begingroup$ Typo: you're defining p1 = ... but using Show[P1, ...] :) $\endgroup$
    – thorimur
    Jun 20 at 20:17

1 Answer 1

3
$\begingroup$

In addition to the typo P1 vs. p1, you're missing a comma in the PlotRange for the axes1 plot. Also note that Show uses the plot range of the first plot, in this case p1. So if you want to show the full range of the axes, you need to specify PlotRange in the Show.

Optionally, you can combine the x,y,z ranges and the RegionFunction in the Contour3D plot by plotting over the region.

Module[{p1, a2, axes1},
 p1 = ContourPlot3D[
   z - y == 3, {x, y, z} \[Element] 
    ImplicitRegion[
     4 x^2 + y^2 <= 9, {{x, -2, 2}, {y, -4, 4}, {z, 0, 6.5}}], 
   ColorFunction -> "DarkRainbow"];
 axes1 = 
  ParametricPlot3D[{{t/2, 0, 0}, {0, t/2, 0}, {0, 0, t}}, {t, 0, 6}];
 a2 = axes1 /. Line[x_] :> {Arrowheads[{0.05}], Arrow[x]};
 Show[p1, a2, PlotRange -> {{-2, 3}, {-4, 3}, {0, 6.5}}]
 ]

enter image description here

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.