Plotting text doesn't disappear for axes inside the text range

33 views
Skip to first unread message

Daniel Mulholland

unread,
Jul 21, 2016, 1:56:44 AM7/21/16
to sage-...@googlegroups.com
Hi,
 
I'd like to report what I think is a bug in sage.
 
 
When selecting xmin, xmax and ymin ymax in a plot, if there is a text 
element, e.g.
 
 
text(lable, midpoint(point,line_end), horizontal_alignment='left', 
vertical_alignment='top', fontsize='xx-small', color='black')
 
 
which is outside the plotting boundaries it is still displayed.
 
See for instance this standalone code fragment:
 
a = plot(x^2, (x,0,5))
b = text("hi there wonderful Sage and SMC people", (30,30), horizontal_alignment='left', vertical_alignment='top', fontsize='xx-small', color='black')
show(sum([a,b]),aspect_ratio=1, xmin=-10,xmax=40, ymin=-10, ymax=40, axes_labels=['$R$ pri. $\Omega$','$X$ pri. $\Omega$'], axes_labels_size=1)
show(sum([a,b]),aspect_ratio=1, xmin=-10,xmax=40, ymin=-10, ymax=20, axes_labels=['$R$ pri. $\Omega$','$X$ pri. $\Omega$'], axes_labels_size=1)
 
The expected behaviour was that text above ymax=20 would not be displayed or would be cut off to fit the axes.

NB: This is a re-send of something sent around 4 June which was during a system failure.

Paul Masson

unread,
Jul 22, 2016, 6:00:02 PM7/22/16
to sage-devel
Daniel, there is an additional option for Text objects that does what you want. Add the keyword argument "clip=True" to your text and it will be clipped according to the min/max settings.

This option is not yet in the documentation, so I've created a ticket to take care of that:


Thanks for pointing this out!
Reply all
Reply to author
Forward
0 new messages