All Questions
Tagged with legend matplotlib
213
questions with no upvoted or accepted answers
6
votes
0
answers
1k
views
How to get leading whitespace in matplotlib labels (legend or xlabel etc.) using latex?
I would like to insert some leading whitespace into some of my legend labels (problem is the same for other types of labels) with latex turned on. However, any leading whitespace that I enter is being ...
6
votes
0
answers
3k
views
Using annotate to place a text box below legend in Matplotlib
I wish to display some text in a Matplotlib plot using annotate(), aligned beneath a legend box. I have examined the solution proposed in How to place a text box directly below legend in matplotlib? ...
5
votes
1
answer
1k
views
How to make a Legend of MatPlotLib patch patterns or add them to a preexisting Legend
How does one make a legend for patch patterns used on a graph or add information on the patch patterns to a preexisting legend without affecting information already present on the legend?
4
votes
0
answers
3k
views
matplotlib: multiple legends in each single subplot
I know how to split the legend of a plot into two separate legends:
x = np.linspace(0,1)
y1 = x
y2 = 2*x
fig, ax = plt.subplots()
fig.set_size_inches((8,8))
points = []
pnts = ax.scatter(x, y1, c='...
3
votes
0
answers
180
views
How do I change de size of the legend with matplotlib? and identify the states on my map
I have made this code for an activity, I am a beginner in python. But when I plot, the legend only shows the first letter of my legend. Also, this map shows a group of states and I would like to know ...
3
votes
0
answers
980
views
Colorbar too big - Python Matplotlib
I want to plot a geodataframe from Buenos Aires, the proportion of poor houses. There's the code:
import pandas as pd
import geopandas as gpd
import matplotlib.pyplot as plt
caba=gpd.read_file('https:...
3
votes
0
answers
315
views
Why legend does not appear outside plot?
I run code from this answer How to put the legend out of the plot in PyCharm in console (Anaconda environment) and it didn't produced right output
I recreated a conda env, but it still does not work.
...
3
votes
0
answers
763
views
Scatter marker and boxplot symbol combined to a single legend key
I want to plot two datasets, the first representing the stage A of a product in development and the second the stage B respectively, using a scatter and boxplot. I used matplotlib's scatter and ...
3
votes
0
answers
1k
views
\mathrm mode for legend labels and legend props in matplotlib
So I am having a little alignment issue with my legend in matplotlib. Hopefully it is easily solvable with the right know-how. I have scoured the matplotlib website but I'm struggling to find the ...
3
votes
1
answer
850
views
Graduated size symbols in legends
I have plotted a bubble chart with the circles' sizes corresponding to a list of values using matplotlib. However, I'm having trouble creating a legend for the plot that has variable size symbols that ...
2
votes
1
answer
460
views
How do I render multiple languages (e.g. Chinese, cyrillic, english) at once in a legend using matplotlib?
I am plotting statistics related to different translations of a word. Using python / matplotlib under Ubuntu I cannot get my legend to show all my languages.
My code below
#!/usr/bin/python
import ...
2
votes
1
answer
454
views
How to specify vertical spacing between overlapping combined legend entries? [Python/Matplotlib]
Goal
Plot two lines or curves in a figure, together with corresponding filled areas which indicate accuracy. See MWE.
Challenge: all handlers overlap in the legend entry. How could I specify vertical ...
2
votes
0
answers
338
views
Is there a simple way to make matplotlib text boxes float like the legend does by default?
I'm able to code what I want after extensively reading the matplotlib docs, but I'm curious if there's a simpler solution. I'll add the relevant code below.
import matplotlib.pyplot as plt
from ...
2
votes
0
answers
268
views
Matplotlib Output Legend box has wrong size in PGF output
currently, I'm struggling with an odd problem which occurs when exporting a matplotlib figure to PGF. As seen in the screenshot (from my LaTeX document), the output has a corrupted legend ...
2
votes
1
answer
413
views
Python matplotlib internal latex rendering has non-uniform legend label spacing?
Using the latex symbol for a right arrow (\rightarrow) for legend labels, with the internal latex rendering in matplotlib, adjusts the line spacing between label entries; see the minimal example below,...