One way to use images as a marker would be to use offsetbox module.
Here is an example adopted from

http://matplotlib.sourceforge.net/examples/pylab_examples/demo_annotation_box.html

Regards,

-JJ


import matplotlib.pyplot as plt
from matplotlib.offsetbox import OffsetImage, AnnotationBbox
from matplotlib.cbook import get_sample_data

import numpy as np

if 1:
    fig = plt.gcf()
    fig.clf()
    ax = plt.subplot(111)


    xy = [0.3, 0.55]

    arr = np.arange(100).reshape((10,10))
    im = OffsetImage(arr, zoom=2)

    ab = AnnotationBbox(im, xy,
                        xycoords='data',
                        pad=0.3,
                        )

    ax.add_artist(ab)


    # another image


    from matplotlib._png import read_png
    fn = get_sample_data("lena.png", asfileobj=False)
    arr_lena = read_png(fn)

    imagebox = OffsetImage(arr_lena, zoom=0.1)

    xy = (0.7, 0.4)
    ab = AnnotationBbox(imagebox, xy,
                        xycoords='data',
                        pad=0.5,
                        )


    ax.add_artist(ab)

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


    plt.draw()
    plt.show()




On Thu, Mar 8, 2012 at 4:25 AM, Michael Droettboom <md...@stsci.edu> wrote:
> It would be a nice idea.  I'm not sure it's something that would work
> terribly well in vector backends as the images may not scale well.  I should
> mention that there is already support to use arbitrary Unicode characters or
> math expressions as markers already, which does work well in vector
> backends.
>
> Mike
>
>
> On 03/07/2012 01:59 PM, C M wrote:
>
> I've for now taken a different approach that means I won't need custom
> markers from images.
>
> But I'm just curious:  is there any wish/plans in Matplotlib to add support
> for this?  I think it could do a lot to expand what's possible in terms of
> the look and feel of plots (even without things drifing into USA Today
> territory!).
>
> Just my $0.02
>
> Che
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
>
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to