Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Display some points by mouse in a plot

This is the code for the plotting what economist call the portfolio frontier

pp=parametric_plot((s(x),x), (x,-5, 6), fill=True,color='grey',alpha=0.01,axes_labels=['$\sigma_p$','$\mathbb{E}_p$'],axes_labels_size=1)
pp+=parametric_plot((s(x),x), (x,0, 6),color='red',)
pp+=parametric_plot((s(x),x), (x,-5, 0),linestyle='--',color='red',)
pp+=points([(5,1),(10,2),(20,-2)],color='blue')
pp+=text("$Pechiney$", (5,.6), alpha=1, fontsize='xx-small', fontweight='bold', color='green')
pp+=text("$LVMH$", (10,1.6), alpha=1, fontsize='xx-small', fontweight='bold', color='green')
pp+=text("$Peugeot$", (20,-2.4), alpha=1, fontsize='xx-small', fontweight='bold', color='green',)
show(pp,aspect_ratio='automatic')

I wonder

1) if it would be possible to display the point and there label, only when the mice is on them ? 2) to click on the grey part of the graph, to make appear a point which display its coordinates ?

NB there is no accessible points outside of the grey zone.

Display some points by mouse in a plot

This is the code for the plotting what economist call the portfolio frontier

pp=parametric_plot((s(x),x), (x,-5, 6), fill=True,color='grey',alpha=0.01,axes_labels=['$\sigma_p$','$\mathbb{E}_p$'],axes_labels_size=1)
pp+=parametric_plot((s(x),x), (x,0, 6),color='red',)
pp+=parametric_plot((s(x),x), (x,-5, 0),linestyle='--',color='red',)
pp+=points([(5,1),(10,2),(20,-2)],color='blue')
pp+=text("$Pechiney$", (5,.6), alpha=1, fontsize='xx-small', fontweight='bold', color='green')
pp+=text("$LVMH$", (10,1.6), alpha=1, fontsize='xx-small', fontweight='bold', color='green')
pp+=text("$Peugeot$", (20,-2.4), alpha=1, fontsize='xx-small', fontweight='bold', color='green',)
show(pp,aspect_ratio='automatic')

I wonder

1) if it would be possible to display the point and there label, only when the mice is on them ? ?

2) to click on the grey part of the graph, to make appear a point which display its coordinates ?

3) I have tried some tricks to supress the "DeprecationWarning" without success. Why does it appears, how to suppress it ?

NB there There is no accessible points outside of the grey zone.

Display some points by mouse in a plot

This is the code for the plotting what economist call the portfolio frontier

pp=parametric_plot((s(x),x), (x,-5, 6), fill=True,color='grey',alpha=0.01,axes_labels=['$\sigma_p$','$\mathbb{E}_p$'],axes_labels_size=1)
pp+=parametric_plot((s(x),x), (x,0, 6),color='red',)
pp+=parametric_plot((s(x),x), (x,-5, 0),linestyle='--',color='red',)
pp+=points([(5,1),(10,2),(20,-2)],color='blue')
pp+=text("$Pechiney$", (5,.6), alpha=1, fontsize='xx-small', fontweight='bold', color='green')
pp+=text("$LVMH$", (10,1.6), alpha=1, fontsize='xx-small', fontweight='bold', color='green')
pp+=text("$Peugeot$", (20,-2.4), alpha=1, fontsize='xx-small', fontweight='bold', color='green',)
show(pp,aspect_ratio='automatic')

I wonder

1) if it would be possible to display the point and there label, only when the mice is on them ?

2) to click on the grey part of the graph, to make appear a point which display its coordinates ?

3) I have tried some tricks to supress the "DeprecationWarning" which arise with this code without success. Why does it appears, how to suppress it ?

NB There is no accessible points outside of the grey zone.

Display some points by mouse in a plot

This is the code for the plotting what economist call the portfolio frontier

pp=parametric_plot((s(x),x), (x,-5, 6), fill=True,color='grey',alpha=0.01,axes_labels=['$\sigma_p$','$\mathbb{E}_p$'],axes_labels_size=1)
pp+=parametric_plot((s(x),x), (x,0, 6),color='red',)
pp+=parametric_plot((s(x),x), (x,-5, 0),linestyle='--',color='red',)
pp+=points([(5,1),(10,2),(20,-2)],color='blue')
pp+=text("$Pechiney$", (5,.6), alpha=1, fontsize='xx-small', fontweight='bold', color='green')
pp+=text("$LVMH$", (10,1.6), alpha=1, fontsize='xx-small', fontweight='bold', color='green')
pp+=text("$Peugeot$", (20,-2.4), alpha=1, fontsize='xx-small', fontweight='bold', color='green',)
show(pp,aspect_ratio='automatic')

I wonder

1) if it would be possible to display the point and there label, only when the mice is on them ?

2) to click on the grey part of the graph, to make appear a point which display its coordinates ?

3) I have tried some tricks to supress the "DeprecationWarning" which arise with this code without success. Why does it appears, how to suppress it ?

NB There is no accessible points outside of the grey zone.

Add I have seen a Python package PyAutoGui. I would like to know if anay body's has an experimetn of it's interaction with Sage.