Skip to main content

All Questions

Tagged with
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 ...
Marco C.'s user avatar
  • 187
0 votes
2 answers
1k views

Handle legend markers independently

I have a plot with two types of lines: solid and dashed. Both solid and dashed lines represent the same quantity for different conditions and they have the same color. Now, I'd like to add in an ax....
ILA's user avatar
  • 3
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,...
silence_of_the_lambdas's user avatar
5 votes
3 answers
26k views

Adding input variables to plot title/legend in Python

I would like to display the current value of a parameter used to plot a certain function in the plot title/legend/annotated text. As a simple example, let's take a straight line: import numpy import ...
dzejkob's user avatar
  • 155
3 votes
1 answer
4k views

"%" sign in a matplotlib Python

Is there any way that I can print a % sign in a plot on python using matplotlib in a Text object or inside a Legend? This basic example, without a raw percent sign, behaves as expected: plt.figure() ...
priscila castillo's user avatar
1 vote
1 answer
1k views

Adding internal spaces in pyplot legend

I would like to justify a legend so that it is both left and right aligned and so that the equals are aligned. For example I have the following code: import numpy as np import matplotlib.pyplot as ...
Shawn's user avatar
  • 199
9 votes
3 answers
8k views

How to make a legend with only text

I have two plots that I want to make legends for, right now they look like this: I just want 'C3H8' and 'CO2' to be in the legend, excluding the blue boxes. Right now I am using the matplotlib....
Syd's user avatar
  • 421
66 votes
3 answers
69k views

Styling part of label in legend in matplotlib

Is it possible to have part of the text of a legend in a particular style, let's say, bold or italic?
englebip's user avatar
  • 1,025