Skip to main content

All Questions

Tagged with
0 votes
0 answers
35 views

Pyoncoprint (matplotlib) legend not showing disappeared ty[es

I'm using such a marker from the example file of the package PyOncoprint: rom matplotlib.patches import Polygon, Rectangle mutation_markers = { "Amplification": dict( marker=&...
Zhihan Zhang's user avatar
0 votes
1 answer
29 views

custom legend function for matplotlib chart

Right now when I have dual y-axis and I want to have one legend box for both of my labels I do the following: fig, ax = plt.subplots(1,2) ax0=ax[0].twinx() line1=ax[0].plot([1, 2, 3], [4, 5, 6], 'b', ...
user20856754's user avatar
0 votes
1 answer
20 views

No colours in legend when using zero handlelength with colours from a colourmap

I'm trying to plot multiple lines, using the colours from the viridis colourmap. I want to set the handlelength=0 in the legend, and when I do, the legend is now totally blank. If I don't mess around ...
Steven Thomas's user avatar
0 votes
2 answers
247 views

Legend in a specific format

I am plotting a graph with a legend using the following command: K = [1e3,1e4] plt.plot(x[:len(y1)], y1, 'o', label=f'Simulation ($K_L$={K[i]:0e})') which produces the following graph: But I want ...
KeplerNick123's user avatar
0 votes
1 answer
53 views

Can anyone advise on how to apply custom ordering of a legend for pywaffle?

I understand that pywaffle accepts parameters of matplotlib.pyplot.legend in a dict. I'm not really across how to apply these parameters to generate a legend with a custom order of categories. Can ...
epidemiologistseekshelp's user avatar
1 vote
1 answer
233 views

matplotlib legend: remove handles, keep labels

I plot many points in different colors and I want the legend to contain only the names in different colors, like this: for x,y,c in my_data: axes.plot(x,y,color=c) legend = axes.legend(loc="...
sds's user avatar
  • 59.5k
1 vote
1 answer
165 views

Multi-Color Legend Entry with Hatches in Matplotlib

I was looking at this code from another StackOverflow post that showed you how to create a legend entry with multiple colors. I tried adapting the code a little to display hatches (//, xx, etc.) in ...
Xavier Merino's user avatar
2 votes
1 answer
63 views

Centering matplotlib legend (errorbars)

I'm trying to center the markers in the second row of my legend. I already tried to follow the instructions of Centering matplotlib legend entries within incomplete/unfilled rows? but I didn't fit for ...
Djova's user avatar
  • 35
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
-1 votes
3 answers
1k views

How to create two different legends from multiple plot calls

I have to create a visualization where there are multiple line plots (trend lines/moving averages etc.), and multiple scatter charts. I have successfully created all the charts in a single plot, ...
Hatim Jhalodwala's user avatar
-1 votes
2 answers
157 views

How to add legend for a scatter plot with title and customized labels and position the legend in any way user wants?

I have created a scatter chart where I have values of a certain column ABC ranging from 0-10. The points have 4 colours: light blue for values less than 2, blue for 2-4, orange for 4-6 and brown for 6 ...
Hatim Jhalodwala's user avatar
0 votes
2 answers
129 views

How to add legend within a for loop [duplicate]

I am trying to scatter some datapoints in matplotlib but am having some issues with displaying the legend properly. After importing and initializing import matplotlib.pyplot as plt import numpy as np ...
Antonio Carnevali's user avatar
1 vote
1 answer
226 views

How to add a legend to a heatmap

I am using a small variation of this really nice code to plot a heatmap. import matplotlib import seaborn as sns import numpy as np from matplotlib.colors import ListedColormap np.random.seed(7) A = ...
Simd's user avatar
  • 20.9k
1 vote
1 answer
53 views

how to avoid over lapping legends and pie chart [duplicate]

I am trying to draw a pie chart using python matplotlib. How to position the legend and pie chart so they are not overlapping each other. My code is as below: import matplotlib.pyplot as plt import ...
PChao's user avatar
  • 429
2 votes
2 answers
71 views

How to consolidate labels in legend

So, the script below requests data from postgres database and draws a diagram. The requested data is a table with 4 columns (ID, Object, Percentage, Color). The data: result = [ (1, 'Apple', 10, '...
muted_buddy's user avatar

15 30 50 per page
1 2 3
4
5
69