0

I created a heatmap where correlations of two entities are visualized. However, as the matrix is symmetric i added significance values below the diagonal for higher information density. As those values are usually far smaller than the ones of the correlation coefficient I want to use a second colormap to differentiate between the upper and lower diagonal of the matrix. The code is the following:

fig = px.imshow(data,
                labels=dict(x="Correlation of Returns", y="", color="PCC"),
                x=domain,
                y=domain, 
                color_continuous_scale=px.colors.diverging.balance,
                zmin=-1, zmax=1
            )

The data object simply is my nxn matrix as a list of lists. Domain is my label values. The following graph already contains one colormap:Sample HeatMap. Is there a way to add a second one and refer it to the values below the diagonal? I didn't find a solution online yet. Thanks in advance!

Note: I am using Dash, so I may need to stick to plotly figures and won't be able to use e.g. matplotlib

5eb
  • 14,798
  • 5
  • 21
  • 65
LK1999
  • 113
  • 6
  • 1
    Please try to provide a [mcve](/helm/mcve)? In particular share at lease a sample of your data. – rpanai Aug 18 '20 at 01:40
  • Yeah, sure. So the pinned image has the following variables as input: domain = ['MSFT', 'AMZN', 'AAPL'] and data = [[1.00000000e+00, 4.11875508e-01, 5.65918288e-01], [7.11637716e-02, 1.00000000e+00, 7.78219975e-01], [9.29726069e-03, 5.33475167e-05, 1.00000000e+00]]. As one may see, the significance values (lower triangle of data) are far smaller. That's why i would like to have a second colormap to differentiate between those and the correlation values. Hope this makes it more clear. – LK1999 Aug 18 '20 at 12:18
  • @LK1999 Please don't share data in a *comment*. Please do it like [described here](https://stackoverflow.com/questions/63163251/pandas-how-to-easily-share-a-sample-dataframe-using-df-to-dict/63163254#63163254) – vestland Sep 01 '20 at 05:23

0 Answers0