# Revision history [back]

Hello, @Cyrille!

The first thing I can suggest you is to remove the first line of your code:

var("b, p, w")


This is useless in this particular case, because you don't use those variables in a symbolic way, but in a numerical way, as you can see for the first two of them, when you write

b = 1 # pouvoir de monopole
p = 0.5 # probabilité qu'il ne se produise rien


You are effectively overwriting the variables. The third one, w, is not even used.

For the rest of this answer (specially for the purpose of referring to line numbers), I am assuming that you have already deleted the first line of your code:

Concerning T4, I can see that you have two T4; one is in line 8 of your code:

T4 = text("Ligne de certitude?", (9,9))


while the other is in line 14:

T4 = text("W0", (8,-.5), color="black", fontsize='small')


So, the second T4 is overriding the first one. What you could do is, starting on line 14, rename T4 to T5; then in line 15, rename T5 to T6; in line 16, rename T6 to T7. That should solve your problem.

Concerning inslin, I don't know if this is problem of formatting of your question above, or an actual problem, but I found that you are missing the multiplication symbol after every variable b. Now, I am assuming b is the same variable as in line 1. If it's a function, then the notation is correct, but you forgot to define the function b. You should use another letter, though, because b already has a meaning.

Concerning text rotation, you can indeed do it by using the rotate option for the text command. For example, in order to rotate the text in T4 by an angle of 45 degrees, you can do

T4 = text("Ligne de certitude?",(8.8,9.2), fontsize="small", rotation=45)


Finally, the beauty of Sage is that you can use LaTeX almost anywhere you want. So, for your question is you can render labels and text in LaTeX, you just have to enclose the words with $ symbols. For example, if you would like to write W2 as$W_2$, you just have to replace line 6: T2 = text("W2", (-.5,10), color="black", fontsize='small')  with the almost identical T2 = text("$W_2$", (-.5,10), color="black", fontsize='small')  I hope you don't mind, but I would also like to give you a programming advise: Don't mix single quote (') with double quote (") signs. They have the same meaning in Python/SageMath, so you can use them indifferently, but it is considered poor programming style to mix them. I am writing a version of your code with all these and some other minor modifications. Please check it here. By the way, I didn't find the definition of plot g in your code, so I will work without it; also, I like single quotes. I hope this helps! Hello, @Cyrille! The first thing I can suggest you is to remove the first line of your code: var("b, p, w")  This is useless in this particular case, because you don't use those variables in a symbolic way, but in a numerical way, as you can see for the first two of them, when you write b = 1 # pouvoir de monopole p = 0.5 # probabilité qu'il ne se produise rien  You are effectively overwriting the variables. The third one, w, is not even used. For the rest of this answer (specially for the purpose of referring to line numbers), I am assuming that you have already deleted the first line of your code: Concerning T4, I can see that you have two T4; one is in line 8 of your code: T4 = text("Ligne de certitude?", (9,9))  while the other is in line 14: T4 = text("W0", (8,-.5), color="black", fontsize='small')  So, the second T4 is overriding the first one. What you could do is, starting on line 14, rename T4 to T5; then in line 15, rename T5 to T6; in line 16, rename T6 to T7. That should solve your problem. Concerning inslin, I don't know if this is problem of formatting of your question above, or an actual problem, but I found that you are missing the multiplication symbol after every variable b. Now, I am assuming b is the same variable as in line 1. If it's a function, then the notation is correct, but you forgot to define the function b. You should use another letter, though, because b already has a meaning. Concerning text rotation, you can indeed do it by using the rotate option for the text command. For example, in order to rotate the text in T4 by an angle of 45 degrees, you can do T4 = text("Ligne de certitude?",(8.8,9.2), fontsize="small", rotation=45)  Finally, the beauty of Sage is that you can use LaTeX almost anywhere you want. So, for your question is you can render labels and text in LaTeX, you just have to enclose the words with $ symbols. For example, if you would like to write W2 as $W_2$, you just have to replace line 6:

T2 = text("W2", (-.5,10), color="black", fontsize='small')


with the almost identical

T2 = text("$W_2$", (-.5,10), color="black", fontsize='small')


I hope you don't mind, but I would also like to give you a programming advise: Don't mix single quote (') with double quote (") signs. They have the same meaning in Python/SageMath, so you can use them indifferently, but it is considered poor programming style to mix them.

I am writing a version of your code with all these and some other minor modifications. Please check it here. By the way, I didn't find the definition of plot g in your code, so I will work without it; also, I like single quotes.quotes. The result should look like this:

I hope this helps!

Hello, @Cyrille!

The first thing I can suggest you is to remove the first line of your code:

var("b, p, w")


This is useless in this particular case, because you don't use those variables in a symbolic way, but in a numerical way, as you can see for the first two of them, when you write

b = 1 # pouvoir de monopole
p = 0.5 # probabilité qu'il ne se produise rien


You are effectively overwriting the variables. The third one, w, is not even used.

For the rest of this answer (specially for the purpose of referring to line numbers), I am assuming that you have already deleted the first line of your code:

Concerning T4, I can see that you have two T4; one is in line 8 of your code:

T4 = text("Ligne de certitude?", (9,9))


while the other is in line 14:

T4 = text("W0", (8,-.5), color="black", fontsize='small')


So, the second T4 is overriding the first one. What you could do is, starting on line 14, rename T4 to T5; then in line 15, rename T5 to T6; in line 16, rename T6 to T7. That should solve your problem.

Concerning inslin, I don't know if this is problem of formatting of your question above, or an actual problem, but I found that you are missing the multiplication symbol after every variable b. Now, I am assuming b is the same variable as in line 1. If it's a function, then the notation is correct, but you forgot to define the function b. You should use another letter, though, because b already has a meaning.

Concerning text rotation, you can indeed do it by using the rotate option for the text command. For example, in order to rotate the text in T4 by an angle of 45 degrees, you can do

T4 = text("Ligne de certitude?",(8.8,9.2), fontsize="small", rotation=45)


Finally, the beauty of Sage is that you can use LaTeX almost anywhere you want. So, for your question is you can render labels and text in LaTeX, you just have to enclose the words with $ symbols. For example, if you would like to write W2 as$W_2$, you just have to replace line 6: T2 = text("W2", (-.5,10), color="black", fontsize='small')  with the almost identical T2 = text("$W_2\$", (-.5,10), color="black", fontsize='small')


To answer your last question, yes, you can write a text spreading many lines. You simply should add the line break character, which is written as \n, in a text. For example, if you write T1 as

T1 = text('Loteries\n inaccesibles', (3.5,9.5), color='red', fontsize='small')


or even as

T1 = text('Loteries\ninaccesibles', (3.5,9.5), color='red', fontsize='small')


you will get the text written in two lines. You can add as many break lines as you want to a text.

I hope you don't mind, but I would also like to give you a programming advise: Don't mix single quote (') with double quote (") signs. They have the same meaning in Python/SageMath, so you can use them indifferently, but it is considered poor programming style to mix them.

I am writing a version of your code with all these and some other minor modifications. Please check it here. By the way, I didn't find the definition of plot g in your code, so I will work without it; also, I like single quotes. The result should look like this:

I hope this helps!