Scatter Plotting With Custom Markers?
22 次查看(过去 30 天)
显示 更早的评论
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!!
0 个评论
采纳的回答
Walter Roberson
2023-3-1
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.
更多回答(1 个)
dpb
2023-3-1
编辑:dpb
2023-3-1
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 个评论
Walter Roberson
2023-3-1
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
2023-3-2
"...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...
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!