Skip to main content

All Questions

1 vote
1 answer
200 views

Combine catplot legend with other legends in seaborn

I want to combine multiple plot legends with a catplot legend and place the single result in the upper right. I also want to replace the labels on both. Examples - {"avg tip":"average&...
ciaran haines's user avatar
1 vote
1 answer
82 views

Choosing elements for a legend in Python

I am using py.plot to display the upper and lower bounds of confidence intervals (shaded in between). I would like to label each pair of bounds with the item they are measuring. However, Python seems ...
josephbags's user avatar
0 votes
1 answer
38 views

Custom colored lines in matplotlib but legend won't update

I am trying to plot lines out of a pandas dataframe, a pivot table of my data. There's 12 lines, one for each month of the year, and I don't want any duplicate colors. So I decided to set the colors ...
user21551428's user avatar
0 votes
1 answer
175 views

Adjust spacing between 2 markers of same line displayed in the legend of matplotlib plot

I am plotting 2 markers of the same line using the following code and I want to adjust the spacing between two markers in the legend. Code : ref. import matplotlib.pyplot as plt from matplotlib....
Natasha's user avatar
  • 1,431
0 votes
1 answer
60 views

Unable to visualize legend correctly in matplotlib

I am trying to visualize this graph with a lineplot, but the legend is not working correctly as you can see in the image below. The problems are three: two rectangles appear in the second and fourth ...
Francis's user avatar
0 votes
0 answers
210 views

How to map colors from multiple matplotlib subplot pie charts to a single figure legend

So I have been trying to get a legend working for a figure with multiple subplots that contain pie charts. The pie charts can contain any number of manufactures from a set list of manufacturers, but ...
Kgrover3's user avatar
0 votes
2 answers
701 views

Matplotlib: display legend keys for lines as patches by default

For background, see the legend guide. I want to display legend keys for Line2D objects as Patches (with the same color and label), by default. What is the cleanest way to do this? I tried using ...
user76284's user avatar
  • 1,329
0 votes
0 answers
387 views

Find best coordinates in PIL image for insert rectangular image

I edited this post in order to ask a more clear question. Starting from a figure plot generate by Matplotlib like this : Bitmap data is returned by a function: from PIL import Image from matplotlib ...
F48R1's user avatar
  • 37
0 votes
1 answer
107 views

Removing legend duplicates leaves unmatched colors between the legend and the lines (matplotlib, python)

I have multiple .dat files looking like this: first file and second file . Firstly, I used this code: z_bins = 541 h_bins = 65 for nr in [1,2]: array = [] profile = "file_{}.dat"....
HungryMolecule's user avatar
0 votes
1 answer
553 views

How to plot every label once in matplotlib legend with corresponding color? [duplicate]

How can I only show a name once in the legend with corresponding color instead of index? data = {'x':[0, 1, 2, 3, 4], 'y':[4, 3, 2, 1, 0], 'Name':['Tom', 'Nick', 'Tom', 'Nick', 'Emma']...
JonnDough's user avatar
  • 887
0 votes
1 answer
3k views

How to set markers with errorbars in different colours?

How to: display symbols in the legend colour markers in the same way as the errorbars (argument color gives an error: ValueError: RGBA sequence should have length 3 or 4 remove connecting lines - get ...
Elena Greg's user avatar
  • 1,125
0 votes
0 answers
118 views

How to add a legend according to colors?

How to add a legend according to colors? I looked at this question, but I got an error about handles. What is wrong, please? import matplotlib.pyplot as plt import pandas as pd fig, ax = plt.subplots(...
Elena Greg's user avatar
  • 1,125
0 votes
0 answers
941 views

Fancybox is not working. What am I doing wrong?

I was following an example from Python Data Science Handbook which is plotting a simple graph. Its supposed to use fancybox on labels but it is not working as per the example. The code is: x = np....
omsinghml's user avatar
1 vote
0 answers
78 views

Matplotlib legend shows two same colors for a different data

I would like to make a function that generate plots for different dataset. My idea is to make list of bank for the function to generate each bank's credit growth or loan to funding ratio. However, ...
najmaashrawi's user avatar
-1 votes
1 answer
233 views

Issue with Label in Stacked Bar chart in Matplotlib from a Pandas Dataframe

I have a Dataframe with a column (say 'Col') with values either from this list ['PO101','NI101','NE101']. Count is: PO101 = 30000 NI101 = 5000 NE101 = 3000 I am trying to show how many are which on ...
Veki's user avatar
  • 541

15 30 50 per page
1
2 3 4 5