# Clipping a 2D plot

Dear all,

Best is a small example:

def fC(p):
return([p[0]/(p[0]+2), (p[1]+1)/(p[0]+2)])

def actOnD(Dom, nbsteps, myz):
DomainfC = list(map(fC, Dom))
acolor = Color(0, (20+90*nbsteps)/255, 150/255)
ToPlot = polygon(Dom, color = acolor, zorder = myz)
if nbsteps > 0:
DomainfC = list(map(fC, Dom))
ToPlot += actOnD(DomainfC, nbsteps-1, myz+1)
return(ToPlot)

actOnD( [[0,0], [0,1], [1,1], [1,0]], 3, 1)


And I would like to show only the plot within a smaller square than the unit one. It seems add_conditions works for parametric plot (though I did not find the documentatin for that, only posts). Many thanks for your lights on that!

Best, Olivier

edit retag close merge delete

To make a block of code, the syntax is to indent by 4 spaces, which you can do by using the 101010 button.

( 2022-09-21 14:13:11 +0100 )edit

Sort by ยป oldest newest most voted

The trick is to give a name to the Sage object actOnD( [[0,0], [0,1], [1,1], [1,0]], 3, 1) (which is a plot):

sage: P = actOnD( [[0,0], [0,1], [1,1], [1,0]], 3, 1)


Then, you can have a look at its available methods:

sage: P.<tab>


You can see that there is a show option with tons of options:

sage: P.show?


For example, you can set :

sage: P.show(xmax=0.4, ymin=0.3, aspect_ratio=1)

more

Many thanks for all that! I had misinterpreted the meaning of xmax, xmin, ymax, ymin family :/ Best, O.

( 2022-09-22 09:26:22 +0100 )edit