Hi,

I am plotting several different symbols using 3 different colours. The
colours indicate different data sets, whereas the symbols need not be
explained. I would therefore like each label to have a different colour,
i.e. each line in my legend should be written in a different colour
specified. The legend is getting too long if I have to indicate what each
symbol represents, plus it would be a repetition of the 3 data sets in
question. How can I change the colour of the text in the legend?

Second, how can I change the marker in the legend? I am plotting using
errorbar(), but the marker shows up as a dot, and I would like it to show up
as a '+', without having to change the actual dots in the plot.

Here is a snippet of my code:

import matplotlib as mpl
import matplotlib.pyplot as plt

fig = plt.figure(); ax = []
for k in range(1,4):
    ax.append(fig.add_subplot(3,1,k))
    for [data,col,leg] in
[[data1,'k','set1'],[data2,'r','set2'],[data3,'b','both']]:
       
ax[-1].errorbar(data[:,2],data[:,4],xerr=data[:,3],yerr=data[:,5],fmt='.',color=col,label=leg)
        ax[-1].plot(x,y,'-',color=col,label=leg)
        lgd=ax[-1].legend(loc='lower right')
        #this is what I tried to change the symbols in the legend, but it
also changes the plot
        #symbols and I would like to avoid that:
        plt.setp(lgd.get_lines(), marker='+')


I have searched this forum, other forums, and google, without finding an
answer to my questions. If there is another post or webpage already dealing
with these problems I apologise for posting them here too and ask you to
please direct me to the right pages.

Cheers, Karianne
-- 
View this message in context: 
http://old.nabble.com/legend%3A-changing-the-text-colour-tp29614647p29614647.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to