px.imshow(facet_col_wrap) messes with facet_col index
First my example:
imgs = np.array([
[[0, 0], [0, 0]],
[[0, 0], [0, 1]],
[[0, 0], [1, 0]],
[[0, 0], [1, 1]],
[[0, 1], [0, 0]],
[[0, 1], [0, 1]],
[[0, 1], [1, 0]],
[[0, 1], [1, 1]],
[[1, 0], [0, 0]],
])
labels = [str(i) for i in range(9)]
fig = px.imshow(imgs, facet_col=0, facet_col_wrap=3)
for i, label in enumerate(labels):
print(f"{fig.layout.annotations[i]['text']=}")
fig.layout.annotations[i]['text'] = label
fig.show()
According to the docs the titles of imshow facets can be set by the for loop. But using facet_col_wrap messes with the index. Instead of [0,...,8] its [6,7,8,3,4,5,0,1,2], i.e. indexing the images from left/top to right/bottom but plotting the images from left/bottom to right/top. So the docs are not accurate and only apply for not facet_col_wrap
Generally, it would be nice to have something like facet_titles in imshow which accepts a list of titles, or even better make imshow accept DataFrames like f.e. px.scatter as described in Facet and Trellis Plots.
Same issue here. Do you have any solution for this ?
Hi - we are tidying up stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for a while, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. If you'd like to submit a PR, we'd be happy to prioritize a review, and if it's a request for tech support, please post in our community forum. Thank you - @gvwilson