Ask Your Question

Centering the graphics output

asked 2020-04-22 08:41:04 +0100

Cyrille gravatar image

Is there a way to ask Sagemath to center the graphics in the page ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-04-22 11:27:14 +0100

ortollj gravatar image

Hi Cyrille

What OS and What Sagemath notebook ?

look here

for me with Ubuntu 18.04 and Sagemath notebook 9.0 it is working with putting:

.output_png {
    display: table-cell;
    text-align: center;

at the end in my css file:./local/lib/python3.7/site-packages/notebook/static/custom/custom.css

like it is recommended in the link above. image description

edit flag offensive delete link more


I also have a question that I allow myself to add in comment in your question(because it is in relation): how to do so that in the code following the x-axis scale is the same as the y-axis? (so that the angle between the pink vector and the black vector appears at right angles)

u=[1, 3]
v=[3, 4]
p=[9/5, 12/5]
plt=plot(arrow((0,0),v,color='black',width=5,legend_label='V', legend_color='black'))
plt+=plot(arrow((0,0),u,color='red',width=5,legend_label='U', legend_color='red'))

plt+=plot(arrow(p,u,color='pink',width=5,legend_label='W',linestyle='dashed', legend_color='pink'))

ortollj gravatar imageortollj ( 2020-04-22 11:33:32 +0100 )edit

I would add aspect_ratio=1 as an option in show.

Juanjo gravatar imageJuanjo ( 2020-04-23 01:22:45 +0100 )edit

Thank you Juanjo, I got a nice right angle now with the option you recomend ;-)

ortollj gravatar imageortollj ( 2020-04-23 07:51:13 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2020-04-22 08:41:04 +0100

Seen: 444 times

Last updated: Apr 22 '20