Skip to main content

All Questions

Tagged with
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
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
2 votes
1 answer
457 views

Need legend to communicate color for plotly graph go.Heatmap

I'm having a bit of trouble trying to figure out how to have the legend indicate color for my plotly graph objects heatmap. The legend only needs to communicate the graph colors and what they mean. ...
IDK's user avatar
  • 161
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
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
2 votes
1 answer
724 views

Plotly: group trace in legend and removing horizontal labels

I'm using Plotly to produce a similar graph from https://plotly.com/python/horizontal-bar-charts/, section "Color Palette for Bar Chart". Here's the code, based on the reference link, but ...
user188439's user avatar
0 votes
1 answer
46 views

Scatter plot legend with respect to colour [Python3]

I have this MWE of six points to plot: import matplotlib.pyplot as plt plt.scatter(1,2,marker= 'o', color='darkred') plt.scatter(3,5,marker= 'o', color='yellowgreen') plt.scatter(11,21,marker= 'o', ...
Siderius's user avatar
  • 194
1 vote
1 answer
169 views

How to add legend with labels of IDs to my code

I have the electricity consumption of 25 houses, and Im doing K-Means clustering on the dataset that holds those houses. After importing the dataset, pre-processing it, and applying K-Means with K=2, ...
Aghyad Skaif's user avatar
0 votes
1 answer
371 views

Prevent Matplotlib Legend from smushing h-padding on vertical subplots?

I have a script where I am plotting several variables in a grid of 5x1. I have noticed that when I have data that makes my legend shorter, the subplots themselves have an acceptable height and ...
dylanjm's user avatar
  • 2,081
0 votes
1 answer
93 views

How to make a legend in a plot?

I am unable to figure out a way to get a legend of my plot. My data is a data frame consisting of 3 columns x, y and z. x and y represent the co-ordinates of a point and z is the label(0,1,2,3) that ...
Akhilesh Sharma's user avatar
0 votes
1 answer
628 views

Plotly legends on subplot position

I would like to put legends on subplot position. Is there any solution? It will be great if you can provide any type of suggestions. You can find the code here: https://github.com/sjshtura/EWL-DUE/...
Advut's user avatar
  • 117
2 votes
1 answer
136 views

How to plot the legend of this graph of which there are many functions?

I have a matrix X contains only 1 row that serves as an input. I have a matrix Y of which each row serves as an output of a function. If Y has 5 rows, then we have 5 different functions. I plot all ...
Akira's user avatar
  • 2,780
1 vote
1 answer
284 views

I want to make an automatic legend in seaborn, but it doesn't work

I want to make an automatic legend in seaborn, but it doesn't work. How can I generate the legend automatically? plt.figure(figsize=(15, 10)) sns.pointplot(data=tmp_hs_df, x="Geographic Area", y="...
dahuin's user avatar
  • 77

15 30 50 per page