Skip to main content

All Questions

Tagged with
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
175 views

Error when drawing a legend on a separate plot

I want to plot a legend on a separate frame than the original plot. I can plot the legend from plot commands. But not the legend from fill_between. Here is a sample code #!/usr/bin/env python import ...
Marti's user avatar
  • 69
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
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
0 answers
112 views

Matplotlib Legend and colormaps from panda dataframes

I am trying to plot some graphs with Python. Specifically I am working with dataframes. I would like to know how to do the next couple of things: Adapt the legend of the plots using the correspondant ...
felixpradoh's user avatar
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
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
0 votes
2 answers
1k views

How to change the location of a legend in seaborn countplot? [duplicate]

There is the following code which produces a countplot with seaborn and annotating the precentage: ax = sns.countplot(y=target_column, data=data, hue=target_column) plt.title(f'Distribution of {...
KaliTheGreat's user avatar
0 votes
0 answers
205 views

Subplot legend showing wrong colors [duplicate]

I am a bit surprised by plot legends color assignment. I am plotting values and assigning a color in loop. The code is pasted below. import matplotlib.pyplot as plt angles2plot = [0.5, 1.0, 2....
Vinod Kumar's user avatar
  • 1,562
2 votes
1 answer
3k views

matplotlib legend based only on line style but not color

I am plotting values of two metrics for two different algorithms in different style and colors in a single plot. I use different styles for different algorithms and different colors for different ...
Shew's user avatar
  • 1,606
18 votes
1 answer
29k views

Sharing same legends for subplots in plotly

I've two plots created in the same figure using subplots in plotly. import plotly.graph_objects as go import numpy as np import pandas as pd from plotly.subplots import make_subplots df = pd....
Natasha's user avatar
  • 1,431
2 votes
1 answer
170 views

How to modify scatter-plot figure legend to show different formats for the same types of handles?

I am trying to modify the legend of a figure that contains two overlayed scatter plots. More specifically, I want two legend handles and labels: the first handle will contain multiple points (each ...
user avatar
1 vote
0 answers
94 views

Legend for marker size

I'm trying to but legend for marker size in Sccater plot there is some plot to describe what I want ( See Prediction Cost on the right ) Plot With Legend for marker size I did all what I want ...
Abdulwahabdev's user avatar

15 30 50 per page
1 2
3
4 5
7