Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Help on text and colours

1 Ansicht (letzte 30 Tage)
nty huy
nty huy am 27 Sep. 2019
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
so i have this graph
t = linspace(0,5*2*pi)';
y = cos(t);
plot(t,cos(t))
and i want some text in the middle how do i show the graph and the text this is what i have
t = text(0.5,0.5,'text');
s = t.FontSize;
t.FontSize = 11;
but whenever i use it the graph wont show
and how do i change the colour
  1 Kommentar
Katarina Vuckovic
Katarina Vuckovic am 27 Sep. 2019
You can use title('Enter Text') or legend('Enter Text')
As for the color, if you want to change to color of the plot use: https://www.mathworks.com/help/matlab/ref/linespec.html
If you want to change the color of the title: https://www.mathworks.com/help/matlab/ref/title.html

Antworten (2)

madhan ravi
madhan ravi am 27 Sep. 2019
https://in.mathworks.com/help/matlab/ref/matlab.graphics.chart.primitive.line-properties.html
https://in.mathworks.com/help/matlab/ref/text.html#busm58r-2
  1 Kommentar
KALYAN ACHARJYA
KALYAN ACHARJYA am 27 Sep. 2019
t = linspace(0,5*2*pi)';
y = cos(t);
plot(t,cos(t))
%hold on;
t=text(15,0,'Text');
s = t.FontSize;
t.FontSize = 15;

Katarina Vuckovic
Katarina Vuckovic am 27 Sep. 2019
You can use title('Enter Text') or legend('Enter Text')
As for the color, if you want to change to color of the plot use: https://www.mathworks.com/help/matlab/ref/linespec.html
If you want to change the color of the title: https://www.mathworks.com/help/matlab/ref/title.html

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by