legend id not showing my data

3 views (last 30 days)
Yael Chudkov
Yael Chudkov on 15 Jun 2022
Answered: KSSV on 15 Jun 2022
hello,
I'm trying to put a legend on my plot. I wrote the names I need but it doesnt show them, it shows "data 1" and "data 2".
%% Timeseries HRF
[voxRow, vocCol] = find(corrMat(:, :, slice_idx) == max(max(max(corrMat(:, :, slice_idx)))));
voxTime = squeeze(M(voxRow, vocCol, slice_idx, :));
figure()
title ('HRF time series of a voxel with strong correlation from slice number #', num2str(slice_idx), 'FontSize', 10)
hold on
xlabel('Frame number');
ylabel('Correlation');
legend('voxel activity','stimuli', 'FontSize', 7);
plot(1 : trails_N, mat2gray(voxTime)')
hold on
plot(1 : trails_N, hrfVec);

Answers (1)

KSSV
KSSV on 15 Jun 2022
Try this:
figure()
hold on
title ('HRF time series of a voxel with strong correlation from slice number #', num2str(slice_idx), 'FontSize', 10)
xlabel('Frame number');
ylabel('Correlation');
plot(1 : trails_N, mat2gray(voxTime)')
plot(1 : trails_N, hrfVec);
legend('voxel activity','stimuli', 'FontSize', 7);

Tags

Community Treasure Hunt

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

Start Hunting!