Skip to main content

All Questions

Tagged with
4 votes
1 answer
3k views

How to create a legend separated by color and linestyle

I'm generating a figure that has 4 curves (for example), divided into 2 types - Type1 and Type2 (2 curves of each type). I'm drawing Type1 as a solid line while Type2 is dashed. To not overload the ...
MRm's user avatar
  • 567
1 vote
2 answers
604 views

Left aligning markers in legend with legend title using matplotlib

I'm trying to make a plot with Matplotlib, and I would look to have the legend on the top left. Without a legend title this is working fine with the code below, but when I add a legend title which is ...
Wouter's user avatar
  • 3,241
0 votes
1 answer
236 views

Remove points from a plot legend

I have this code that shows the Lagrange interpolation between set of points(x,y cordination). Using matplotlib: import numpy as np from scipy.interpolate import lagrange import matplotlib.pyplot as ...
Eitan Rosati's user avatar
1 vote
1 answer
571 views

Set manual location of legend with matplotlib and GetDistTool

I try to set manually the location for the main legend of a main plot produced by Getdist tool. The plot below represents the 1/2 sigma confidence levels coming from a covariance matrix with joint ...
user avatar
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
1 vote
1 answer
360 views

How to plot an unstructured numpy array with a legend?

Is it possible, when plotting an n-dimensional unstructured array with matplotlib, to produce a legend label for each dimension? The solution of a system of ODEs, when using scipy.integrate.odeint, ...
Zack Fair's user avatar
  • 229
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
-1 votes
1 answer
62 views

Adding legends into a Graph made using Matplotlib and Numpy (multiple plots from a txt file)

I had some really good help from here when I asked a question before so I thought I'd jump on again to get some help, here's my code so far: import numpy as np import matplotlib.pyplot as plt import ...
SuperFlapjack's user avatar
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
3 votes
1 answer
3k views

Legend for colour and for marker

I want to plot the values of two matrices in a scatter plot. For each of the points of the scatterplot, I want to see in which column and which row they are. For the different rows, I use different ...
Jorre Goossens's user avatar
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
1 vote
1 answer
76 views

Plotting a legend with matplotlib: error

I am trying to add a legend to my graph in matplotlib. instead of creating a legend it puts the full list of all mylabels in the legend. My graph looks like this: The legend is cut off and i cant ...
Thom Elliott's user avatar
1 vote
1 answer
3k views

Plotting legend for 2D numpy array

I like to create a legend based on certain numbers using Numpy and Matplotlib but to no avail. So I started to play around with a test function to get it right before transferring this to my main ...
quenchlemon's user avatar
1 vote
1 answer
3k views

Multiple legends and multiple colors/shapes matplotlib

I want to plot data from about 20+ files at same time. I am trying to plot each set of data from each file in different color and each with different legend. I have seen some examples and also the ...
user avatar

15 30 50 per page