Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Enhancing a plot

 f0(x)=3-x
f1(x)=2*x-6
f2(x)=1+(1/3)*x
p=plot(f0(x),x,1,3.5,thickness=3)
p+=plot(f1(x),x,2.7,4.5,thickness=3)
p+=plot(f2(x),x,1,4.5,thickness=3)
sol0=solve(f0==f1,x)
sol1=solve(f0==f2,x)
sol2=solve(f1==f2,x)
p+=point((sol0[0].rhs(),f1(sol0[0].rhs())), rgbcolor=(0.26, 0.80, 0.50),size=60, zorder=10,axes_labels=['$x_1$','$x_2$'])
p+=point((sol1[0].rhs(),f2(sol1[0].rhs())), rgbcolor=(0.26, 0.80, 0.50),size=60, zorder=10)
p+=point((sol2[0].rhs(),f1(sol2[0].rhs())), rgbcolor=(0.26, 0.80, 0.50),size=60, zorder=10)
p+=point((0,f2(sol2[0].rhs())), rgbcolor=(0.99, 0.86, 0.23),size=60, zorder=10)

p+=point((0,0), rgbcolor=(0.99, 0.86, 0.23),size=60, zorder=10)
p+=line([(0,0),(0,f2(sol2[0].rhs()))],rgbcolor=(.5, 0.5, 0.69),thickness=3, zorder=8)
p+=point((sol1[0].rhs(),0), rgbcolor=(1, 0.1, 0.5),size=60, zorder=10)
p+=point((sol2[0].rhs(),0), rgbcolor=(1, 0.1, 0.5),size=60, zorder=10)
p+=line([(sol1[0].rhs(),0),(sol2[0].rhs(),0)],rgbcolor=(1, 0.5, 0.69),thickness=3, zorder=8)
p+=polygon([(sol0[0].rhs(),f1(sol0[0].rhs())),(sol1[0].rhs(),f2(sol1[0].rhs())),(sol2[0].rhs(),f1(sol2[0].rhs()))], rgbcolor=(0.9098, 0.3804, 0))
p+=text("$\\mathrm{Points }\\,\\, \\mathrm{intérieurs}$",(2.8,1.2), color='white')
p+=text("$x_2=3-x_1$",(1.9,.6),rotation=-44.0, horizontal_alignment='left')
p+=text("$x_2=2x_1-6$",(3.5,1.2),rotation=62.0, horizontal_alignment='left')
p+=text("$0$",(-.15,0.1), horizontal_alignment='center',color='black',fontsize=12)
p+=text("$x_2=1+(1/3)x_1$",(3,2.2),rotation=16.0, horizontal_alignment='center')
p+=line([(sol1[0].rhs(),0),(sol1[0].rhs(),f2(sol1[0].rhs()))],linestyle="--",color='black')
p+=line([(sol2[0].rhs(),0),(sol2[0].rhs(),f2(sol2[0].rhs())), (0,f2(sol2[0].rhs()))],linestyle="--",color='black')
p+=line([(0,0), (sol1[0].rhs(),0)],linestyle="--",color='black')
show(p,aspect_ratio=1,axes=[False, False])#,transparent=True)

In the precedent plot, I would like that the axes be removed between the yellow and the red dot on the horizontal axes because I need to place an horizontal dashed line in place. Is it possible?

And other question is to display the value of the points on the axes.

Last point it seems there is no possibility to fill a polygon with a transparent color.

And last but not least, I have seen that opacity is normaly obtained by different word as opacity or alpha according to the context.

Enhancing a plot

 

f0(x)=3-x f1(x)=2*x-6 f2(x)=1+(1/3)*x f1(x)=2x-6 f2(x)=1+(1/3)x p=plot(f0(x),x,1,3.5,thickness=3) p+=plot(f1(x),x,2.7,4.5,thickness=3) p+=plot(f2(x),x,1,4.5,thickness=3) sol0=solve(f0==f1,x) sol1=solve(f0==f2,x) sol2=solve(f1==f2,x) p+=point((sol0[0].rhs(),f1(sol0[0].rhs())), rgbcolor=(0.26, 0.80, 0.50),size=60, zorder=10,axes_labels=['$x_1$','$x_2$']) p+=point((sol1[0].rhs(),f2(sol1[0].rhs())), rgbcolor=(0.26, 0.80, 0.50),size=60, zorder=10) p+=point((sol2[0].rhs(),f1(sol2[0].rhs())), rgbcolor=(0.26, 0.80, 0.50),size=60, zorder=10) p+=point((0,f2(sol2[0].rhs())), rgbcolor=(0.99, 0.86, 0.23),size=60, zorder=10) zorder=10)

p+=point((0,0), rgbcolor=(0.99, 0.86, 0.23),size=60, zorder=10)
p+=line([(0,0),(0,f2(sol2[0].rhs()))],rgbcolor=(.5, 0.5, 0.69),thickness=3, zorder=8)
p+=point((sol1[0].rhs(),0), rgbcolor=(1, 0.1, 0.5),size=60, zorder=10)
p+=point((sol2[0].rhs(),0), rgbcolor=(1, 0.1, 0.5),size=60, zorder=10)
p+=line([(sol1[0].rhs(),0),(sol2[0].rhs(),0)],rgbcolor=(1, 0.5, 0.69),thickness=3, zorder=8)
p+=polygon([(sol0[0].rhs(),f1(sol0[0].rhs())),(sol1[0].rhs(),f2(sol1[0].rhs())),(sol2[0].rhs(),f1(sol2[0].rhs()))], rgbcolor=(0.9098, 0.3804, 0))
p+=text("$\\mathrm{Points }\\,\\, \\mathrm{intérieurs}$",(2.8,1.2), color='white')
p+=text("$x_2=3-x_1$",(1.9,.6),rotation=-44.0, horizontal_alignment='left')
p+=text("$x_2=2x_1-6$",(3.5,1.2),rotation=62.0, horizontal_alignment='left')
p+=text("$0$",(-.15,0.1), horizontal_alignment='center',color='black',fontsize=12)
p+=text("$x_2=1+(1/3)x_1$",(3,2.2),rotation=16.0, horizontal_alignment='center')
p+=line([(sol1[0].rhs(),0),(sol1[0].rhs(),f2(sol1[0].rhs()))],linestyle="--",color='black')
p+=line([(sol2[0].rhs(),0),(sol2[0].rhs(),f2(sol2[0].rhs())), (0,f2(sol2[0].rhs()))],linestyle="--",color='black')
p+=line([(0,0), (sol1[0].rhs(),0)],linestyle="--",color='black')
show(p,aspect_ratio=1,axes=[False, False])#,transparent=True)

In the precedent plot, I would like that the axes be removed between the yellow and the red dot on the horizontal axes because I need to place an horizontal dashed line in place. Is it possible?

And other question is to display the value of the points on the axes.

Last point it seems there is no possibility to fill a polygon with a transparent color.

An other question, how to have the ticks in computer modern because two fonts is not nice.

And last but not least, I have seen that opacity is normaly obtained by different word as opacity or alpha according to the context.

Enhancing a plot

Consider the following code.

f0(x)=3-x
    f1(x)=2x-6
    f2(x)=1+(1/3)x
    f1(x)=2*x-6
f2(x)=1+(1/3)*x
p=plot(f0(x),x,1,3.5,thickness=3)
 p+=plot(f1(x),x,2.7,4.5,thickness=3)
 p+=plot(f2(x),x,1,4.5,thickness=3)
 sol0=solve(f0==f1,x)
 sol1=solve(f0==f2,x)
 sol2=solve(f1==f2,x)
 p+=point((sol0[0].rhs(),f1(sol0[0].rhs())), rgbcolor=(0.26, 0.80, 0.50),size=60, zorder=10,axes_labels=['$x_1$','$x_2$'])
 p+=point((sol1[0].rhs(),f2(sol1[0].rhs())), rgbcolor=(0.26, 0.80, 0.50),size=60, zorder=10)
 p+=point((sol2[0].rhs(),f1(sol2[0].rhs())), rgbcolor=(0.26, 0.80, 0.50),size=60, zorder=10)
 p+=point((0,f2(sol2[0].rhs())), rgbcolor=(0.99, 0.86, 0.23),size=60, zorder=10)

zorder=10)

p+=point((0,0), rgbcolor=(0.99, 0.86, 0.23),size=60, zorder=10)
p+=line([(0,0),(0,f2(sol2[0].rhs()))],rgbcolor=(.5, 0.5, 0.69),thickness=3, zorder=8)
p+=point((sol1[0].rhs(),0), rgbcolor=(1, 0.1, 0.5),size=60, zorder=10)
p+=point((sol2[0].rhs(),0), rgbcolor=(1, 0.1, 0.5),size=60, zorder=10)
p+=line([(sol1[0].rhs(),0),(sol2[0].rhs(),0)],rgbcolor=(1, 0.5, 0.69),thickness=3, zorder=8)
p+=polygon([(sol0[0].rhs(),f1(sol0[0].rhs())),(sol1[0].rhs(),f2(sol1[0].rhs())),(sol2[0].rhs(),f1(sol2[0].rhs()))], rgbcolor=(0.9098, 0.3804, 0))
p+=text("$\\mathrm{Points }\\,\\, \\mathrm{intérieurs}$",(2.8,1.2), color='white')
p+=text("$x_2=3-x_1$",(1.9,.6),rotation=-44.0, horizontal_alignment='left')
p+=text("$x_2=2x_1-6$",(3.5,1.2),rotation=62.0, horizontal_alignment='left')
p+=text("$0$",(-.15,0.1), horizontal_alignment='center',color='black',fontsize=12)
p+=text("$x_2=1+(1/3)x_1$",(3,2.2),rotation=16.0, horizontal_alignment='center')
p+=line([(sol1[0].rhs(),0),(sol1[0].rhs(),f2(sol1[0].rhs()))],linestyle="--",color='black')
p+=line([(sol2[0].rhs(),0),(sol2[0].rhs(),f2(sol2[0].rhs())), (0,f2(sol2[0].rhs()))],linestyle="--",color='black')
p+=line([(0,0), (sol1[0].rhs(),0)],linestyle="--",color='black')
show(p,aspect_ratio=1,axes=[False, False])#,transparent=True)

In the precedent resulting plot, I would like that the axes be removed to replace the portion of the horizontal axis between the yellow dot and the red dot on the horizontal axes because I need to place an dot by a horizontal dashed line in place. line. Is it possible?

And other Another question is how to display the value values of the points on the axes.

Last point Also, it seems there is no possibility to fill a polygon with a transparent color.

An other question, Another question: how to have the ticks in computer modern because two fonts is not nice.

And last but not least, I have seen that opacity is normaly obtained normally obtained by different word words as opacity or alpha according to the context.

Enhancing a plot

Consider the following code.

f0(x)=3-x
f1(x)=2*x-6
f2(x)=1+(1/3)*x
p=plot(f0(x),x,1,3.5,thickness=3)
p+=plot(f1(x),x,2.7,4.5,thickness=3)
p+=plot(f2(x),x,1,4.5,thickness=3)
sol0=solve(f0==f1,x)
sol1=solve(f0==f2,x)
sol2=solve(f1==f2,x)
p+=point((sol0[0].rhs(),f1(sol0[0].rhs())), rgbcolor=(0.26, 0.80, 0.50),size=60, zorder=10,axes_labels=['$x_1$','$x_2$'])
p+=point((sol1[0].rhs(),f2(sol1[0].rhs())), rgbcolor=(0.26, 0.80, 0.50),size=60, zorder=10)
p+=point((sol2[0].rhs(),f1(sol2[0].rhs())), rgbcolor=(0.26, 0.80, 0.50),size=60, zorder=10)
p+=point((0,f2(sol2[0].rhs())), rgbcolor=(0.99, 0.86, 0.23),size=60, zorder=10)

p+=point((0,0), rgbcolor=(0.99, 0.86, 0.23),size=60, zorder=10)
p+=line([(0,0),(0,f2(sol2[0].rhs()))],rgbcolor=(.5, 0.5, 0.69),thickness=3, zorder=8)
p+=point((sol1[0].rhs(),0), rgbcolor=(1, 0.1, 0.5),size=60, zorder=10)
p+=point((sol2[0].rhs(),0), rgbcolor=(1, 0.1, 0.5),size=60, zorder=10)
p+=line([(sol1[0].rhs(),0),(sol2[0].rhs(),0)],rgbcolor=(1, 0.5, 0.69),thickness=3, zorder=8)
p+=polygon([(sol0[0].rhs(),f1(sol0[0].rhs())),(sol1[0].rhs(),f2(sol1[0].rhs())),(sol2[0].rhs(),f1(sol2[0].rhs()))], rgbcolor=(0.9098, 0.3804, 0))
p+=text("$\\mathrm{Points }\\,\\, \\mathrm{intérieurs}$",(2.8,1.2), color='white')
p+=text("$x_2=3-x_1$",(1.9,.6),rotation=-44.0, horizontal_alignment='left')
p+=text("$x_2=2x_1-6$",(3.5,1.2),rotation=62.0, horizontal_alignment='left')
p+=text("$0$",(-.15,0.1), horizontal_alignment='center',color='black',fontsize=12)
p+=text("$x_2=1+(1/3)x_1$",(3,2.2),rotation=16.0, horizontal_alignment='center')
p+=line([(sol1[0].rhs(),0),(sol1[0].rhs(),f2(sol1[0].rhs()))],linestyle="--",color='black')
p+=line([(sol2[0].rhs(),0),(sol2[0].rhs(),f2(sol2[0].rhs())), (0,f2(sol2[0].rhs()))],linestyle="--",color='black')
p+=line([(0,0), (sol1[0].rhs(),0)],linestyle="--",color='black')
show(p,aspect_ratio=1,axes=[False, False])#,transparent=True)

In the resulting plot, I would like to replace the portion of the horizontal axis between the yellow dot and the red dot by a horizontal dashed line. Is it possible?

Another question is how to display the values of the points on the axes.

Also, it seems there is no possibility to fill a polygon with a transparent color.

Another question: how to have the ticks in computer modern because two fonts is not nice.

And last but not least, I have seen that opacity is normally obtained by different words as opacity or alpha according to the context.