Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Deboxed, axes and labels in a linear programming 3Dgraphic

Whichever be my efforts, I fail to obtain a not boxed graphic with labeled axes. I need help. I want also to have the figure in an appropriate scale. Thanks.

p = MixedIntegerLinearProgram()
x = p.new_variable(real=True)
p.add_constraint(2*x[1] + x[2] + 3*x[3] <= 1)
p.add_constraint(3*x[1] + 2*x[2] + x[3] <= 1)
p.add_constraint(x[1] + 3*x[2] + 2*x[3] <= 1)
p.add_constraint(x[1] >= 0)
p.add_constraint(x[2] >= 0)
p.add_constraint(x[3] >= 0)
my_polyhedron = p.polyhedron()
pol=my_polyhedron.plot(color='blue', alpha=.5)
var("x y z")
plane=implicit_plot3d(x + 2*y + 3*z==1, (x,0,0.5), (y,0,0.25),
(z,0,1), color='yellow', alpha=.25,boxed=False)
from sage.plot.plot3d.plot3d import axes
from sage.manifolds.utilities import set_axes_labels
plane+pol+axes(1, color='black', axes_labels=['$x_1$','$x_1$','$x_3$'])

Deboxed, axes and labels in a linear programming 3Dgraphic

Whichever be my efforts, I fail to obtain a not boxed graphic with labeled axes. I need help. I want also to have the figure in an appropriate scale. Thanks.

p = MixedIntegerLinearProgram()
x = p.new_variable(real=True)
p.add_constraint(2*x[1] + x[2] + 3*x[3] <= 1)
p.add_constraint(3*x[1] + 2*x[2] + x[3] <= 1)
p.add_constraint(x[1] + 3*x[2] + 2*x[3] <= 1)
p.add_constraint(x[1] >= 0)
p.add_constraint(x[2] >= 0)
p.add_constraint(x[3] >= 0)
my_polyhedron = p.polyhedron()
pol=my_polyhedron.plot(color='blue', alpha=.5)
var("x y z")
plane=implicit_plot3d(x + 2*y + 3*z==1, (x,0,0.5), (y,0,0.25),
(z,0,1), color='yellow', alpha=.25,boxed=False)
alpha=.25,frame=False)
from sage.plot.plot3d.plot3d import axes
from sage.manifolds.utilities import set_axes_labels
plane+pol+axes(1, color='black', axes_labels=['$x_1$','$x_1$','$x_3$'])

Deboxed, axes and labels in a linear programming 3Dgraphic

Whichever be my efforts, I fail to obtain a not boxed graphic with labeled axes. I need help. I want also to have the figure in an appropriate scale. scale and with the edges in black Thanks.

p = MixedIntegerLinearProgram()
x = p.new_variable(real=True)
p.add_constraint(2*x[1] + x[2] + 3*x[3] <= 1)
p.add_constraint(3*x[1] + 2*x[2] + x[3] <= 1)
p.add_constraint(x[1] + 3*x[2] + 2*x[3] <= 1)
p.add_constraint(x[1] >= 0)
p.add_constraint(x[2] >= 0)
p.add_constraint(x[3] >= 0)
my_polyhedron = p.polyhedron()
pol=my_polyhedron.plot(color='blue', alpha=.5)
var("x y z")
plane=implicit_plot3d(x + 2*y + 3*z==1, (x,0,0.5), (y,0,0.25),
(z,0,1), color='yellow', alpha=.25,frame=False)
from sage.plot.plot3d.plot3d import axes
from sage.manifolds.utilities import set_axes_labels
plane+pol+axes(1, color='black', axes_labels=['$x_1$','$x_1$','$x_3$'])