Mpl_to_plotly limitations

Thanks @chriddyp for the explanations and stating the limitations of plotly. I would like to point out another limitation I have noticed. When converting matplotlib figures into plotly figures using the mpl_to_plotly function, I found that if the x- and y-ticks are non-numeric, they are replaced in the plotly figure by dummy values (0, 1, 2, …). And also if there’s a colorbar in the matplotlib figure, it is not present in the converted plotly figure. Here’s my post about it. Do you have any suggestions/fix to add back the correct tick values and the colorbar during or after the conversion?

mpl_to_plotly hasn’t been updated in several years - we wrote it as a proof-of-concept and determined that it was too difficult to achieve perfect conversions between matplotlib and plotly. We also started investing more energy and effort into our own plotly interface, and were really happy with how it turned out.

So, if mpl_to_plotly ends up working for you, then that’s great! You can keep on using it. However, if it doesn’t work out for you, then I recommend digging into the plotly python interface from first-principles. You’ll be better off in the end for it I think :slight_smile:

I recommend reading https://medium.com/@plotlygraphs/introducing-plotly-py-3-0-0-7bb1333f69c6 to get a better understanding of how the plotly library works and how its “self-documenting” in many ways.

Good luck!

Thanks for that explanation @chriddyp. Makes it clearer for me in terms of what I can to solve this issue; I was thinking maybe I’m missing something in the conversion. I’ll try to see if I can bring back the non-numeric axes tick labels to the converted plotly fig. For now, I’ll follow your advice and edit the library I’m using to directly plot plotly figures instead of matplotlib figures.