Skip to main content

All Questions

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

Adding a Legend to Pandas Scatterplot

I am using the Pandas version of Scatter, not Matplotlib. How would I add a legend to this graph based on the colors?
325's user avatar
  • 596
0 votes
1 answer
298 views

Hiding Bokeh glyphs based on categorical data with color_mapper

Currently i found a way of plotting my categorical data by using the color_mapper and the legend_field variable. My data look the following way: df_plot x y category 0 91....
Maxi Trien's user avatar
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
1 answer
1k views

Plotly - clicking on legend items - how to make an initial setting?

When someone clicks on a legend item, it becomes grey, and the data disappears, for instance, here. It is possible to set that an item from a legend will be grey after opening the .HTML output and ...
Elena Greg's user avatar
  • 1,125
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
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
-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
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
0 answers
146 views

Remove Inexplicable Black Line In Matplotlib Legend

I am using the following code to generate a legend in a separate file. Unfortunately there is a black line in the middle of the legend that has been generated. In the middle of 'permissions ...
dipl0's user avatar
  • 1,067

15 30 50 per page
1
2
3 4 5
7