Skip to main content

All Questions

Tagged with
1 vote
1 answer
46 views

How to add legend of plotted line in a box plot?

I have plotted a set of data in a boxplot, and I have added a line in the plot. I want to have the labels of the median and mean in the legend, and I have got it. However, I'm also trying to add the ...
lolloa's user avatar
  • 27
0 votes
0 answers
359 views

How do i update a matplotlib plot legend/label dynamically? [duplicate]

I want to update the "label"/legend parameter dynamically. It will be an integer variable coming from a function. I want the label to change every time that value in the function changes. so ...
hghebrem's user avatar
0 votes
0 answers
27 views

How to assign labels and color code to data manually in scatter plot [duplicate]

I've three 1-D arrays, BT1=np.random.uniform(180,300,size=[1,100]) #x BT2=np.random.uniform(180,300,size=[1,100]) #y color_code=np.random.choice(0,1,size-[1,100]) #color code fig,ax=plt.subplots() ...
Pixel_Bear's user avatar
0 votes
1 answer
290 views

automatic label and color in matplotlib scatter plot

I have a dataframe like this: data = sample time (h) Voltage 1 1 2.4 1 2 3 1 3 4 1 4 5.1 2 1 2.4 2 2 3.2 2 3 4.2 2 4 5.2 3 1 2.3 3 2 3.3 3 3 4.4 3 4 ...
Saeed 's user avatar
0 votes
1 answer
513 views

Adjusting global legend (labels) of a plot with subplots (which currently overlaps with the plot) - matplotlib, python

I am trying to add a global legend to a plot, the code below does that but the legend then overlaps with the given plot (I'll add the plot below). Is there a way to adjust the legends? The other ...
Saransh's user avatar
  • 75
-1 votes
1 answer
179 views

lables for plots of multiple y value for one x value

I am plotting several y values for one x value at a time using this method: x = [0.3, 0.1, 0.4, 0.65, 0.85, 0.9, 0.125] y = [1,2,3,4,5,6,7] plt.figure() for xe, ye in zip(x, y): plt.scatter([xe] * ...
alex's user avatar
  • 41
0 votes
2 answers
706 views

How can I skip repeated lablels in the legend when I plot using a for-loop?

import pandas as pd import matplotlib.pyplot as plt from random import random DF = {"A":[(random(),random()),(random(),random())], "B":[(random(),random()),(random(),random()...
Paw in Data's user avatar
  • 1,432
0 votes
1 answer
235 views

Matplotlib plot does not show legend

I want to quickly plot a function varying one of its parameters and with a legend showing the value of this parameter: def supergaussian1d(x, x0, Imax, FWHM, n): return Imax * np.exp(-4 * np.log(2)...
david's user avatar
  • 201
9 votes
1 answer
603 views

How to set a title above each marker which represents a same label

I have a first version of legend in the following plot : with the following code : # Plot and save : kmax = 0.3 p11, = plt.plot([0], marker='None', linestyle='None', label='$k_{max} = ...
user avatar
0 votes
0 answers
215 views

creating a custom legend in matplotlib.pyplot

In trying to create a custom legend, I create an array of custom lines from which I want to extract the labels. In a for loop, I create an array of custom_names like this: custom_names=[custom_names,...
jrive's user avatar
  • 228
0 votes
1 answer
4k views

Change the legend enteries by column values in matplotlib

I'm struggling a lot with changing the labels in the legend in matplotlib charts. This is my graph: I would like to change the legend so the labels will be based on the values in column called "name",...
Reut's user avatar
  • 1,582
1 vote
1 answer
1k views

How to return string composed of superscript inside of fraction for matplotlib legend label? [duplicate]

I have coded a routine that plots x and y data. This code also calculates the indices at which the nth derivative d/dx^n (y) changes sign, where n is specified as a function argument. I would like to ...
user avatar
1 vote
1 answer
183 views

Show edges and faces of markers in legend

I have the attached plot, and I like the symbols as plotted with ax.errorbar('mjd', 'aperMag3Ab', label='', fmt='o', color='k', ms=ms*1.4) ax.errorbar('mjd', 'aperMag3Ab', label='WFCAM Y', ...
npross's user avatar
  • 1,846
-1 votes
1 answer
247 views

Number of legend entries equals the size of data set

I'm plotting many sets of data in a for loop. The number of sets and size of sets don't have any problems plotting. When I try to add a legend, things get interesting. I get a legend, but I only get ...
Troy Cracroft's user avatar
1 vote
1 answer
551 views

Set up labels and legend using plt.subplots()

I am using plt.sublot to create a figure with 12 subplots that share the same data so I want to show the labels and legend for one of them. I am accessing and plotting the data from a dictionary that ...
Karina Gutierrez's user avatar

15 30 50 per page