Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Colors in table

This is a nice table witrh the help of two of you (Full thanks)

A = [[10] * 10, [100] + [0] * 9, [11.1] * 9 + [0]] A.extend([[20] * 5 + [0] * 5, [RDF(50)/2^n for n in range(10)]])# RDF = nombre réel en double precision D = deepcopy(A)# copie A dans D en conservant A intacte.

on arrondit uniquement les lignes qui en ont besoin.

D[2] = list(matrix(RDF, A[2]).round(3)[0])
D[4] = list(matrix(RDF, A[4]).round(3)[0])
#on construit la table
hr = [r"${\color{red} n}$" for n in (1 .. 10)]
hc = ["", r"${\definecolor{energy}{RGB}{200, 8, 21}\color{energy}\text{Équirépartition}}$", r"${\definecolor{energy}{RGB}{200, 8, 21}\color{energy}\text{Tout pour un}}$", r"${\definecolor{energy}{RGB}{200, 8, 21}\color{energy}\text{Un déshérité}}$"]
hc += [r"${\definecolor{energy}{RGB}{200, 8, 21}\color{energy}\text{Injustice pour 1/2 population}}$", r"${\definecolor{energy}{RGB}{200, 8, 21}\color{energy}\text{Injustice croissante}}$"]
t = table(D, header_row=hr, header_column=hc)    
show(t)

I have added colors in the column header. But You will see that if I do the same thing in the row header it do not works since the elements of the header needs to be formated. So what can I do ? And if I want some background colors in the cells and change the colors of the cell's fonts ?

Colors in table

This is a nice table witrh the help of two of you (Full thanks)

A = [[10] * 10, [100] + [0] * 9, [11.1] * 9 + [0]]
A.extend([[20] * 5 + [0] * 5, [RDF(50)/2^n [50/2^n for n in range(10)]])# RDF = nombre réel en double precision 
range(10)]])
D = deepcopy(A)# deepcopy(A)  # copie A dans D en conservant A intacte.

intacte # on arrondit uniquement les lignes qui en ont besoin.

besoin
D[2] = list(matrix(RDF, A[2]).round(3)[0])
D[4] = list(matrix(RDF, A[4]).round(3)[0])
#on # on construit la table
hr = [r"${\color{red} n}$" for n in (1 .. 10)]
hc = ["", r"${\definecolor{energy}{RGB}{200, 8, 21}\color{energy}\text{Équirépartition}}$", r"${\definecolor{energy}{RGB}{200, 8, 21}\color{energy}\text{Tout pour un}}$", r"${\definecolor{energy}{RGB}{200, 8, 21}\color{energy}\text{Un déshérité}}$"]
hc += [r"${\definecolor{energy}{RGB}{200, 8, 21}\color{energy}\text{Injustice pour 1/2 population}}$", r"${\definecolor{energy}{RGB}{200, 8, 21}\color{energy}\text{Injustice croissante}}$"]
t = table(D, header_row=hr, header_column=hc)    
show(t)

I have added colors in the column header. But You will see that if I do the same thing in the row header it do not works since the elements of the header needs to be formated. So what can I do ? And if I want some background colors in the cells and change the colors of the cell's fonts ?

Colors in table

This is a nice table witrh with the help of two of you (Full thanks)(many thanks).

A = [[10] * 10, [100] + [0] * 9, [11.1] * 9 + [0]]
A.extend([[20] * 5 + [0] * 5, [50/2^n for n in range(10)]])
D = deepcopy(A)  # copie A dans D en conservant A intacte
# on arrondit uniquement les lignes qui en ont besoin
D[2] = list(matrix(RDF, A[2]).round(3)[0])
D[4] = list(matrix(RDF, A[4]).round(3)[0])
# on construit la table
hr = [r"${\color{red} n}$" for n in (1 .. 10)]
hc = ["", r"${\definecolor{energy}{RGB}{200, 8, 21}\color{energy}\text{Équirépartition}}$", r"${\definecolor{energy}{RGB}{200, 8, 21}\color{energy}\text{Tout pour un}}$", r"${\definecolor{energy}{RGB}{200, 8, 21}\color{energy}\text{Un déshérité}}$"]
hc += [r"${\definecolor{energy}{RGB}{200, 8, 21}\color{energy}\text{Injustice pour 1/2 population}}$", r"${\definecolor{energy}{RGB}{200, 8, 21}\color{energy}\text{Injustice croissante}}$"]
t = table(D, header_row=hr, header_column=hc)    
show(t)

I have added colors in the column header. header row. But You will see that if I do the same thing adding them in the row header it do column does not works work since the elements of the header needs need to be formated. formatted. So what can I do ? do? And if I want some background colors in the cells cells and change the colors of the cell's fonts ?fonts?