필터 지우기
필터 지우기

How can I add a label to scatterplot points with string values as 'ZData'?

조회 수: 11 (최근 30일)
Thi Ng
Thi Ng 2020년 5월 11일
댓글: Thi Ng 2020년 5월 11일
Hi everyone,
I would like to add a label to my scatterplot with the following code:
scatter1 = scatter(x, y, pointsize, c, 'filled', "o", "ZData", Book2); %Book2 is a 4x1 string.
An error meesage occurs saying that 'ZData' has to be a number. My question would be is there an option similar to 'ZData' but for string values?
Thank you for your help.

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 5월 11일
You can use text(): https://www.mathworks.com/help/releases/R2020a/matlab/ref/text.html to add a text to an axes using the x, y, and z coordinates. However, the z-value itself cannot be a string. It needs to be numeric.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by