Update 1
I updated code as below but it didnt help
import pandas as pd import numpy as np
rs = np.random.RandomState(0)
df = pd.DataFrame(rs.rand(10, 10))
corr = df.corr()
corr.style.set_table_styles(
[dict(selector="th",props=[('max-width', '80px')]),
dict(selector="corr.col_heading",
props=[("writing-mode", "vertical-rl"),
('transform', 'rotateZ(-90deg)'),
])])
corr.style.background_gradient(cmap='coolwarm')
CodePudding user response:
Here is how to do it:
import numpy as np
import pandas as pd
rs = np.random.RandomState(0)
df = pd.DataFrame(rs.rand(10, 10))
df.corr().style.background_gradient(cmap="coolwarm").set_table_styles(
[
dict(
selector="th.col_heading",
props=[
("writing-mode", "vertical-rl"),
("transform", "rotateZ(180deg)"),
("height", "5px"),
],
),
]
)
Which outputs: