フィルターのクリア

title for plot segments

1 回表示 (過去 30 日間)
Rotem Bachar
Rotem Bachar 2021 年 3 月 21 日
回答済み: Pavan Guntha 2021 年 3 月 25 日
hi,
we plotted a graph og voltage as a function of time. The firing rate is different for each segment in the plot. We would like to add a title to each sagment stating the firing rate in it. We triend using a regular textbox with no luck. Thanks in advance!
plot(t, Si);
hold on
xlabel('t(sec)');
ylabel('V(mV)');
title('plot');
plot(LM,LM_Vol,'o','MarkerSize',3)
plot(L2H_Times, Si(L2H),'o','MarkerSize',3);
plot(H2L_Times, Si(H2L),'o','MarkerSize',3);
txt = 'Firing rate = 50';
dim =[0 1/18 0 0.2];
annotation('textbox', dim, 'string', txt);
hold off

回答 (1 件)

Pavan Guntha
Pavan Guntha 2021 年 3 月 25 日
I understand that you would like to have multiple titles to a plot corresponding to the firing rate of various segments of that plot. You may try using the text and annotation commands to place text on the plot at appropriate position by providing the co-ordinates of the position at which the text is to be placed to those functions. Here's an example using text command:
figure(1)
plot(t, Si)
text(1, 8, '120 Hz') % Here (1,8) represents the co-ordinates at which '140 Hz' text would be placed.
text(3, 8, '140 Hz')
text(5, 8, '150 Hz')
text(7, 8, '100 Hz')
You can also implement this using the 'Edit plot' feature of Figure window ( Tools -> Edit Plot ) to move the postion of text boxes as per your convenience to make the textboxes look as titles for the respective segements. An illustration of this idea is shown in the figure below:

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by