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!