Re: [Matplotlib-users] Scatter legend with colored marker

2010-08-05 Thread Jorge Scandaliaris
Benjamin Root  writes:
> 

> Probably not directly, but I hadn't thought about that before.  For a set of 
> scatter points that are colored by values, what should the legend show?  In 
> other words, what does it *mean* for there to be a legend for points that are 
> colored in a potentially non-uniform manner?So, maybe this is desired 
> behavior 
> (but possibly by accident)?
> Thanks for your help,
> Ben Root

I thought for a moment that legend was using the color of the first point in the
set, but a quick test reveals that no matter what colormap you specify, the
marker color inside the legend is blue. BTW, I think I've found another thing
related to legend() and scatter plots: the 'numpoints' keyword argument to
legend is not respected, as showed in the example pasted below,

Jorge

---
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt

data0 = np.random.rand(10,2)
data1 = np.random.rand(10,2)
data2 = np.random.rand(10,2)
data = [data0, data1, data2]

fig, ax = plt.subplots(1,1)
norm = mpl.colors.Normalize(0,len(data))
cmap = mpl.cm.afmhot

sc = []
labels = []
for i,d in enumerate(data):
sc.append(ax.scatter(d.T[0], d.T[1], c=np.ones(d.shape[0])*i,
norm=norm, cmap=cmap))
labels.append('data set ' + str(i))
ax.legend(sc, labels, numpoints=1)
plt.show()
---



--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problem getting math symbols into text

2010-08-05 Thread Michael Droettboom
It looks like you're configured for the STIX fonts (the rcParam 
mathtext.fontset = stix), but they are not installed on your system.

Do you have the file "STIXGeneral.ttf" on your system?  Perhaps you need 
to install an additional package.

Mike

On 08/04/2010 03:18 PM, Michael Hannon wrote:
>> Which backend are you using?
>>
>> Can you set the  rcParam "verbose.level" to "debug-annoying" and then
>> send us the output  produced when running a plot?  This will include a
>> number of lines  about font lookup that may help us diagnose the problem.
>>  
>
> Hi, Mike.  I'm currently doing this interactively on a Gnome, X-windows 
> desktop.
>
> The default backend for this is evidently:
>
>  TkAgg
>
> I've appended the debug-annoying output, but it may be, as Ben Root has
> observed,
> that I just need a newer version of matplotlib.
>
> Thanks for your help.
>
> -- Mike
>
>
>
>
>
> backend TkAgg version 8.5
>
 figure()
  
> 
>
 text(0.5, 0.5, r'$\pi$')
  
> 
>
 show()
  
> FigureCanvasAgg.draw
> RendererAgg.__init__
> RendererAgg.__init__ width=650.0, height=490.0
> RendererAgg.__init__ _RendererAgg done
> RendererAgg.__init__ done
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg._get_agg_font
> findfont: Matching
> :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium
>   to DejaVu Sans (/usr/share/fonts/dejavu/DejaVuSans.ttf) with score of 
> 0.10
> RendererAgg._get_agg_font
> RendererAgg.draw_text
> RendererAgg._get_agg_font
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg._get_agg_font
> RendererAgg._get_agg_font
> RendererAgg.draw_text
> RendererAgg._get_agg_font
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg._get_agg_font
> RendererAgg._get_agg_font
> RendererAgg.draw_text
> RendererAgg._get_agg_font
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg._get_agg_font
> RendererAgg._get_agg_font
> RendererAgg.draw_text
> RendererAgg._get_agg_font
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg._get_agg_font
> RendererAgg._get_agg_font
> RendererAgg.draw_text
> RendererAgg._get_agg_font
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg._get_agg_font
> RendererAgg._get_agg_font
> RendererAgg.draw_text
> RendererAgg._get_agg_font
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg._get_agg_font
> RendererAgg._get_agg_font
> RendererAgg.draw_text
> RendererAgg._get_agg_font
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg._get_agg_font
> RendererAgg._get_agg_font
> RendererAgg.draw_text
> RendererAgg._get_agg_font
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg._get_agg_font
> RendererAgg._get_agg_font
> RendererAgg.draw_text
> RendererAgg._get_agg_font
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg._get_agg_font
> RendererAgg._get_agg_font
> RendererAgg.draw_text
> RendererAgg._get_agg_font
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg._get_agg_font
> RendererAgg._get_agg_font
> RendererAgg.draw_text
> RendererAgg._get_agg_font
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg.points_to_pixels
> RendererAgg._get_agg_font
> RendererAgg._get_agg_font
> RendererAgg.draw_text
> RendererAgg._get_agg_font
> RendererAgg._get_agg_font
> findfont: Matching
> :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
>   to DejaVu Sans (/usr/share/fonts/dejavu/DejaVuSans.ttf) with score of 
> 0.10
> findfont: Matching
> :family=STIXGeneral:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
>   to STIXGeneral (/usr/share/fonts/stix/STIXGeneral.otf) with score of 
> 0.00
> findfont: Could not match
> :family=STIXSize1:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0.
>   Returning /usr/share/fonts/un-core/UnDotum.ttf
> findfont: Matching
> :family=STIXGeneral:style=normal:variant=normal:weight=bold:stretch=normal:size=12.0
>   to STIXGeneral (/usr/share/fonts/stix/STIXGeneralBol.otf) with score of
> 0.00
> findfont: Could not

Re: [Matplotlib-users] Scatter legend with colored marker

2010-08-05 Thread Benjamin Root
On Thu, Aug 5, 2010 at 2:48 AM, Jorge Scandaliaris
wrote:

> Benjamin Root  writes:
> >
> 
> > Probably not directly, but I hadn't thought about that before.  For a set
> of
> > scatter points that are colored by values, what should the legend show?
> In
> > other words, what does it *mean* for there to be a legend for points that
> are
> > colored in a potentially non-uniform manner?So, maybe this is desired
> behavior
> > (but possibly by accident)?
> > Thanks for your help,
> > Ben Root
>
> I thought for a moment that legend was using the color of the first point
> in the
> set, but a quick test reveals that no matter what colormap you specify, the
> marker color inside the legend is blue. BTW, I think I've found another
> thing
> related to legend() and scatter plots: the 'numpoints' keyword argument to
> legend is not respected, as showed in the example pasted below,
>
> Jorge
>
> ---
> import numpy as np
> import matplotlib as mpl
> import matplotlib.pyplot as plt
>
> data0 = np.random.rand(10,2)
> data1 = np.random.rand(10,2)
> data2 = np.random.rand(10,2)
> data = [data0, data1, data2]
>
> fig, ax = plt.subplots(1,1)
> norm = mpl.colors.Normalize(0,len(data))
> cmap = mpl.cm.afmhot
>
> sc = []
> labels = []
> for i,d in enumerate(data):
> sc.append(ax.scatter(d.T[0], d.T[1], c=np.ones(d.shape[0])*i,
>norm=norm, cmap=cmap))
>labels.append('data set ' + str(i))
> ax.legend(sc, labels, numpoints=1)
> plt.show()
> ---
>
>
Yes, this was found a little while back and I believe it was fixed for v1.0.

Ben Root
--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Scatter legend with colored marker

2010-08-05 Thread Jae-Joon Lee
On Thu, Aug 5, 2010 at 4:48 PM, Jorge Scandaliaris
 wrote:
> BTW, I think I've found another thing
> related to legend() and scatter plots: the 'numpoints' keyword argument to
> legend is not respected, as showed in the example pasted below,
>
> Jorge

In recent versions, there is a separate parameter : scatterpoints. So
check your document.

 ax.legend(sc, labels, scatterpoints=1)

Regards,

-JJ

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users