On Mon, Nov 30, 2009 at 4:26 AM, Oliver Tomic <oliver.to...@nofima.no>wrote:

> 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* <oliver.to...@nofima.no> / 
> *www.nofima.no*<http://www.nofima.no/>
>
> ------------------------------------------------------------------------------
> 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
>
>
This is a very detailed description indeed :)

A simple test code in Ipython v0.10:

plt.scatter(np.random.rand(20), np.random.rand(20), c='r', marker='o',
label='test')
plt.legend()

This works as you originally have expected here. (circles on the legend) I
am not sure how much this to do with the svn version of the matplotlib.

================================================================================
Platform     :
Linux-2.6.29.6-217.2.3.fc11.i686.PAE-i686-with-fedora-11-Leonidas
Python       : ('CPython', 'tags/r26', '66714')
IPython      : 0.10
NumPy      : 1.4.0.dev
Matplotlib   : 1.0.svn
================================================================================



-- 
Gökhan

<<image/jpeg>>

------------------------------------------------------------------------------
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