Legend looks very weird
13 ビュー (過去 30 日間)
古いコメントを表示
Hello!
I'm having trouble plotting legend.
The items in the legend are overlaid on top of each other, and no matter what I try, they always look that way. Could anyone help me to make it look normal again, and tell me what is wrong with it?
Thank you so much in advance!!!
% now draw
figure;
plot(tmid,Cer,'ko-',tmid,Put,'ro-',tmid,Caud,'bo-');
xlabel('Time (min)'); ylabel('Radioactivity (Bq/mL)');
legend('Cerebellum','Putamen','Caudate');
ax = gca; ax.YAxis.Exponent = 0;
cd(paths.figures)
print('-dpdf','-bestfit',[ num2str(IDs(id)) num2str(d) '.pdf']);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/268038/image.png)
4 件のコメント
Guillaume
2020 年 1 月 24 日
Can you replace the initial figure call with
figure('Renderer', 'painters');
and see if that fixes the issue?
See also Resolving low-level graphics issues
採用された回答
Yair Altman
2020 年 1 月 27 日
Run the following and check if you still see the same problem:
plot(1:3,1:3,'ko-', 1:3,2:4,'ro-', 1:3,3:5,'bo-');
legend('Cerebellum','Putamen','Caudate');
If you see the same problem it could mean that your legend function is corrupted. Run whos('legend','-all') and check if you have an unexpected version of the legend function on your Matlab path.
If you don't see the same problem, it might be a problem with your data in some strange way. In any case it will help narrow down the possibilities.
2 件のコメント
Star Strider
2020 年 1 月 27 日
A similar problem (and apparent diagnosis but not cure) has been posted in Markers and text in legend appear misaligned. Considering that the plot is with respect to brain nuclei, EEGLAB could be the culprit.
Guillaume
2020 年 1 月 27 日
From the various questions we've seen over the years, it seems that EEGlab has a nasty habit of replacing essential matlab functions with their own, which ends up breaking matlab in all sort of interesting ways.
その他の回答 (1 件)
Harsha Priya Daggubati
2020 年 1 月 27 日
Hi,
Can you share the data or atleast dimensions of the data you are trying to plot, since this issue is not reproducible at my end.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Legend についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!