Scatter Plotting With Custom Markers?

17 views (last 30 days)
Hello all,
I am trying the make a scatter plot that represents all 32 NFL teams comparing total yards gained vs total yards allowed. I also want the marker size to indicate the win percentage of each team. I was informed that the scatter() function can do that. However, I also need to represent each team with their logo as a custom marker. Is there a way to do that?
Thanks!!

Accepted Answer

Walter Roberson
Walter Roberson on 1 Mar 2023
Unfortunately, there is no support for custom markers in any Mathworks function that I can think of.
I seem to recall some File Exchange contributions that work with custom markers.
The general process is to describe the marker in terms of a patch() object centered around (0,0), and to copyobj() the patch adding the centre of the new location to the patch coordinates.

More Answers (1)

dpb
dpb on 1 Mar 2023
Edited: dpb on 1 Mar 2023
There's no way I'm aware of to use an image as a marker in a line or scatter object,
There's a <FEX submission> that will let you define a custom marker, but it uses patch which needs the vertices to draw a polygonal shape defined by coordinates vectors. That won't do for an image of a team logo.
; to do that you'll have to have an image to be able to put on an axes on top of a scatter object or limage that has a 'CData' property and use <image> to change the color data in the area around the X,Y coordinates, scaled to match the size. This will be no mean trick and, I'd think, it'll be hard to get an identifiable logo down to the few pixels you'll have to work with.
Research the content of the Image Processing toolbox, however; I don't have it so it may have something more suited to the purpose, but I think the last part above will still be a problem.
  3 Comments
Walter Roberson
Walter Roberson on 1 Mar 2023
For images you can use surface() objects instead of patch() objects, and set texture mapping. Or use warp
... Or just image() the images into place specifying XData and YData... and probably being careful with the AlphaMask. Probably you would just create one representative object and copyobj() multiple times, setting the XData and YData to the new coordinates.
The image() approach requires more steps to rotate.
dpb
dpb on 2 Mar 2023
"...Or just image() the images into place specifying XData and YData..."
That's what I was suggesting above, yes. However it's attempted, it's not going to be a trivial task methinks...

Sign in to comment.

Tags

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!