I called plt.pie with autopct='%1.1f%%' and got the labels I wanted. However,
when I added the line
mpl.rcParams['text.usetex'] = True
the % disappeared from my labels. I'd like to be able to use LaTex for text,
but can't figure out how to get the % back on my labels.
I've read the documentation for autopct
autopct: [ None | format string | format function ]
If not None, is a string or function used to label the wedges with
their numeric value. The label will be placed inside the wedge. If it is a
format string, the label will be fmt%pct. If it is a function, it will be
called.
and I am wondering what a format function would look like. All of the
examples using autopct that I can find use a format string similar to
%1.1f%% and none seem to use functions.
So my questions are:
1) How might I get the % back on my labels (whether this requires a format
function or not)?
2) What would a format function look like when used with autopct?
···
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/What-is-a-autopct-format-function-tp39315.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
Hi Mark,
2012/10/8 mgurling <magurling@…287…>
I called plt.pie with autopct=‘%1.1f%%’ and got the labels I wanted. However,
when I added the line
mpl.rcParams[‘text.usetex’] = True
the % disappeared from my labels. I’d like to be able to use LaTex for text,
but can’t figure out how to get the % back on my labels.
in (La)Tex % is a comment and to print it you have to escape it with ‘'. Have you tried autopct=’%1.1f%'?
Cheers,
Francesco
···
I’ve read the documentation for autopct
autopct: [ None | format string | format function ]
If not None, is a string or function used to label the wedges with
their numeric value. The label will be placed inside the wedge. If it is a
format string, the label will be fmt%pct. If it is a function, it will be
called.
and I am wondering what a format function would look like. All of the
examples using autopct that I can find use a format string similar to
%1.1f%% and none seem to use functions.
So my questions are:
- How might I get the % back on my labels (whether this requires a format
function or not)?
- What would a format function look like when used with autopct?
–
View this message in context: http://matplotlib.1069221.n5.nabble.com/What-is-a-autopct-format-function-tp39315.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
Don’t let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users