user238469
user238469

Reputation:

How can I change the color of a font with function text( ) in Matlab?

marker={'r','b','g'};
for i=1:size(X,3)
    for r=1:size(X,1)
        for c=1:size(X,2)
            text(X(r,c,i),Y(r,c,i),Z(r,c,i),num2str(dof(c,r,i)))
        end
    end
end

For each value of i, I want to use a different color as given in marker to plot num2str(dof(c,r,i)). How can I do that? Thanks.

Upvotes: 1

Views: 9535

Answers (1)

kaybe
kaybe

Reputation: 36

I'm on the wrong computer (no matlab for testing) right now, but

text(X(r,c,i),Y(r,c,i),Z(r,c,i),num2str(dof(c,r,i)), 'Color', marker{i})

should work. There will be problems if size(X,1)>3 this way however.

Upvotes: 2

Related Questions