Skip to main content

All Questions

Tagged with
1 vote
1 answer
186 views

Displaying row sum in a secondary colorbar while plotting matrix

I'm plotting a matrix using matshow. I have an array sum = np.sum(A, axis=0) I'd like to display the values stored in sum as a secondary legend. import numpy as np import matplotlib.pyplot as plt ...
Natasha's user avatar
  • 1,431
0 votes
0 answers
105 views

How to plot legends for all (only 4) types of value in a 2D array using matplotlib?

I have a 2-D array where each value is either of 0,1,2,3 and I am plotting it like: array = two_d_array #two_d_array is a numpy 2-D array plt.imshow(array) This gives me a plot where each pixel is ...
Sulphur's user avatar
  • 574
0 votes
2 answers
2k views

How to stop matplotlib legend text overlapping?

I am using python-3.x and I would like to find a way to stop legend in the right of the line overlapping as you can see from the following image: I am trying to make it look similar to the following ...
azeez's user avatar
  • 497
2 votes
2 answers
1k views

How to create a basic legend to a multicolored line?

I am currently finishing a bigger project and the last part is to add a simple legend to a plot of a multicolored line. The line only contains two different colors. The following image shows the plot ...
zorrolo's user avatar
  • 117
0 votes
1 answer
3k views

how to display legend iterating over list of values

I'm trying to plot a dummy graph with several lines and a legend in which each of the values in the list "label" will be displayed once for each of the corresponding lines. In the following MWE, each ...
Maxwell's Daemon's user avatar