Hi,

I am not sure whether this has been reported before or maybe even got 
fixed already. When I make scatter plot and plot a point with marker = 'o' 
it appears as a circle in the plot as it should. It won't, however, appear 
in the legend. 

Windows XP
Python(x,y) 2.6.0
matplotlib 0.99.1 (I think :-)


Example:
ax.scatter([x_assF[6]], [y_assF[6]], s=35, c='r', marker='o', 
label='Ecological') 

doesn't show in the legend. When I change the same line of code to

ax.scatter([x_assF[6]], [y_assF[6]], s=35, c='r', marker='8', 
label='Ecological')

that is, the marker is now set to marker='8', then it will appear as a 
circle in the legend. Is this a bug or am I messing something up here? 
Finde complete code and data sets below:



[CODE START]
# -*- coding: utf-8 -*-
"""
correlationPlot_fig15.2.py
"""

# Import necessary modules
import numpy as np
import matplotlib.pyplot as plt


# Import data for correlation plot
assF = np.loadtxt('Apples_flowerFlavour_assF_corrPlot.txt')
all = np.loadtxt('Apples_flowerFlavour_allAssessors_corrPlot.txt')

x_assF = assF[:,1].copy()
y_assF = assF[:,0].copy()

x_all = all[:,1].copy()
y_all = all[:,0].copy()


# Plot correlation plot values 
fig = plt.figure()
ax = fig.add_subplot(111)
ax.scatter(x_all, y_all, s=10, c='w', marker='o', edgecolor='grey', 
label='_')
# NOTE: label='_' excludes the lable from legend

ax.scatter([x_assF[0]], [y_assF[0]], s=50, c='r', marker='s', label='Alpe 
Golden')
ax.scatter([x_assF[1]], [y_assF[1]], s=50, c='r', marker='v', 
label='Granny Smith')
ax.scatter([x_assF[2]], [y_assF[2]], s=50, c='r', marker='d', label='Green 
Star')
ax.scatter([x_assF[3]], [y_assF[3]], s=50, c='r', marker='^', 
label='Kanzi')
ax.scatter([x_assF[4]], [y_assF[4]], s=50, c='r', marker='>', label='Pink 
Lady')
ax.scatter([x_assF[5]], [y_assF[5]], s=50, c='r', marker='<', label='Royal 
Gala')
ax.scatter([x_assF[6]], [y_assF[6]], s=35, c='r', marker='o', 
label='Ecological')

ax.plot([0,10], [0,10], 'b--')

ax.set_xlim(0,10)
ax.set_ylim(0,10)

# Fix legend settings
plt.legend(loc='lower right', shadow=True, scatterpoints=1)
ltext = plt.gca().get_legend().get_texts()
plt.setp(ltext[0], fontsize = 10, color = 'k')

ax.set_xlabel('Score - panel average')
ax.set_ylabel('Score - assessor F')

plt.show()
[CODE END]



Vennlig hilsen / Yours sincerely
Oliver Tomic
Research scientist, Dr. scient


Osloveien 1
1430 Ås
Norway
Tel: +47 6497 0252
Mob: +47 9574 6167
oliver.to...@nofima.no / www.nofima.no

<<image/jpeg>>

4       2.4
1       1
1       1.23
3.25    2.31
4.65    3.14
2.9     1.95
3.45    2.12
3.55    2.4
1       1
1       1.23
1       2.31
3.35    3.14
1       1.95
2.45    2.12
1       2.4
1       1
1       1.23
4.65    2.31
5.3     3.14
1.85    1.95
3       2.12
1       2.4
1       1
1       1.23
1.2     2.31
1       3.14
1       1.95
1.55    2.12
3.6     2.4
1       1
1.95    1.23
1.65    2.31
3.05    3.14
3.15    1.95
2.6     2.12
1.8     2.4
1       1
1.5     1.23
1.85    2.31
2.15    3.14
1.65    1.95
1.8     2.12
4       2.4
1       1
1       1.23
3.25    2.31
4.65    3.14
2.9     1.95
3.45    2.12
2.3     2.4
1       1
1       1.23
2.45    2.31
2.2     3.14
1       1.95
1.75    2.12
2.45    2.4
1       1
1.6     1.23
1.5     2.31
2.45    3.14
2.1     1.95
1.45    2.12
1.9     2.4
1       1
1       1.23
3.2     2.31
4.1     3.14
2.9     1.95
1       2.12
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to