Share colormap for Plotly Stacked Heatmaps

Hello everyone,

I am creating a faceted plot using the Plotly backend and and having trouble with stacking subplots of heatmaps. Specifically, the colorbars appear to overlap and I would prefer if they shared a single colorbar. I have included a screenshot of the current behavior.

Here is the code I am currently using (some dummy data included to reproduce the error without taking too long to do the filtering) - Note some minor label and value changes when I created the dummy data versus my project data.

# Example set up
using Dataframes
using Plotly

# Dummy data
_a = DataFrame(Dict{String, Any}(
    "alpha" => [1,1,1,1,2,2,1,1,1,1,2,2],
    "beta" => [2,2,3,3,3,3,2,2,3,3,3,3],
    "aggregation" => ["OR","OR","OR","OR","OR","OR","XOR","XOR","XOR","XOR","XOR","XOR"],
    "edit_distance" => [0.029, 0.030, 0.036, 0.036, 0.036, 0.037, 0.033, 0.033, 0.039, 0.037, 0.053, 0.054]

# Heatmap, layer pairs vs edit distance, restricted to XOR aggregation
p2 = heatmap(filter(row -> row.aggregation == "XOR", _a),
    x=:alpha, y=:beta, z=:edit_distance,

# Heatmap, layer pairs vs edit distance, restricted to OR aggregation
p3 = heatmap(filter(row -> row.aggregation == "OR", _a),
    x=:alpha, y=:beta, z=:edit_distance,

# Faceted plot
p = make_subplots(
    rows=2, cols=1, shared_xaxes=true, shared_yaxes=true,
    subplot_titles=["XOR aggregation" "OR aggregation"]

## Adding panels
add_trace!(p, p2, row=2, col=1)
add_trace!(p, p3, row=1, col=1)

## Formating parent plot
relayout!(p, title_text="Example for Forum")

# Plotting faceted plot

I’ve perused the Plotly Julia references (Heatmap traces and Subplots in particular) and so far have not quite been able to find what I want. In the end, I want a single shared colorbar that describes the heatmaps in both panels, like the below screenshot EDIT: New users can only post one embedded media, I am told, so look somewhere on this page for it - the colorbar of the first example there is what I mean. EDIT 2: New users can only put two links in their posts, so just google “Heatmaps Julia Plotly” and you will find it :man_facepalming:

Any help would be greatly appreciated!

P.S. This is my first time posting here! I looked through the forums to ensure this wasn’t a duplicate, but to the best of my quick search I didn’t find anything. I have gotten a lot of help from this forum with other issues before and I am excited to finally start participating myself. Time to start looking where I can contribute solutions, too :eyes:

See this thread

Awesome, looks like I didn’t do a thorough enough job searching. Thank you!