Does anybody have a suggestion on what's the best way to present overlapping lines on a plot? I have a lot of them, and I had the idea of having full lines of different colors where they don't overlap, and having dashed lines where they do overlap so that all colors are visible and overlapping colors are seen.
But still, how do I that.
Dot Size. You can try to decrease marker size in your plot. This way they won't overlap and the patterns will be clearer.
Use legend() method to avoid overlapping of labels and autopct. To display the figure, use show() method.
Double-click on the plot to open the Plot Details dialog, go to the Pattern tab in Plot Details, and set the Transparency control to 51%. Select the Spacing tab, and set Gas Between Bars to zero and Overlap to 100.
Just decrease the opacity of the lines so that they are see-through. You can achieve that using the alpha variable. Example:
plt.plot(x, y, alpha=0.7)
Where alpha ranging from 0-1, with 0 being invisible.
I have the same issue on a plot with a high degree of discretization.
Here the starting situation:
import matplotlib.pyplot as plt grid=[x for x in range(10)] graphs=[ [1,1,1,4,4,4,3,5,6,0], [1,1,1,5,5,5,3,5,6,0], [1,1,1,0,0,3,3,2,4,0], [1,2,4,4,3,2,3,2,4,0], [1,2,3,3,4,4,3,2,6,0], [1,1,3,3,0,3,3,5,4,3], ] for gg,graph in enumerate(graphs): plt.plot(grid,graph,label='g'+str(gg)) plt.legend(loc=3,bbox_to_anchor=(1,0)) plt.show()
No one can say where the green and blue lines run exactly
and my "solution"
import matplotlib.pyplot as plt grid=[x for x in range(10)] graphs=[ [1,1,1,4,4,4,3,5,6,0], [1,1,1,5,5,5,3,5,6,0], [1,1,1,0,0,3,3,2,4,0], [1,2,4,4,3,2,3,2,4,0], [1,2,3,3,4,4,3,2,6,0], [1,1,3,3,0,3,3,5,4,3], ] for gg,graph in enumerate(graphs): lw=10-8*gg/len(graphs) ls=['-','--','-.',':'][gg%4] plt.plot(grid,graph,label='g'+str(gg), linestyle=ls, linewidth=lw) plt.legend(loc=3,bbox_to_anchor=(1,0)) plt.show()
I am grateful for suggestions on improvement!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With