You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to use plt.subplots to plot multiple sequences in a single figure, using the option sharex=True in order to keep the same scale for all the sequences.
This means that shorter sequences get "squeezed" when drawn, and labels are closer together than they would be if they didn't share the x axis with the longer sequences. This is not taken into account and labels end up overlapping.
Thank you for your attention and thank you for this package, it is very well made and I really like the approach to coding shown in the documentation.
Please find attached the code and data used to generate this example.
Thanks for bringing attention to this. I believe a solution would not be trivial, as the core algorithm that works on one plot and places the labels need to be made aware of the true size of the plot.
A workaround is to set labels_spacing big enough to put each label on its own line:
What happens when you plot 2 sequences in a figure with share_x is:
The library first plots the upper sequence. At this time, it is well plotted, and the labels don't overlap. But the levels are computed under the assumption that the sequence will take the whole width.
Then library then plots the second plot, and updates the x axis limits. Because of share_x, this can squeeze the upper plot, and cause the labels to overlap.
If I remember correctly there is an easy fix which is to use x_lim so that all plots get plotted with the right x scale from the start:
I tried to use plt.subplots to plot multiple sequences in a single figure, using the option sharex=True in order to keep the same scale for all the sequences.
This means that shorter sequences get "squeezed" when drawn, and labels are closer together than they would be if they didn't share the x axis with the longer sequences. This is not taken into account and labels end up overlapping.
Thank you for your attention and thank you for this package, it is very well made and I really like the approach to coding shown in the documentation.
Please find attached the code and data used to generate this example.
overlapping_labels.zip
The text was updated successfully, but these errors were encountered: