필터 지우기
필터 지우기

How to reproduce a figure?

조회 수: 4 (최근 30일)
Tomaszzz
Tomaszzz 2022년 3월 22일
댓글: Tomaszzz 2022년 3월 28일
Hi all,
The below figure is a copy from a journal and I would like to use such a figure to present my own data.
I would like to write a code that will reproduce the below figure or at least have an advice for a methodology to do this so that I can develop it myself. For example, how to make shading between 0.8 and 1 or how to split the graph in three columns.
The points are circle, square and diamond and error bars are std.
Could you help please?

채택된 답변

Voss
Voss 2022년 3월 22일
편집: Voss 2022년 3월 22일
f = figure();
ax = axes( ...
'Parent',f, ...
'NextPlot','add');
% grey shading on top:
p = patch( ...
'Parent',ax, ...
'XData',[0 1 1 0], ...
'YData',[0.75 0.75 1 1], ...
'FaceColor',[0.8 0.8 0.8], ...
'EdgeColor','none');
% line separating axes into 3 parts:
gl = line( ...
'Parent',ax, ...
'XData',[1 1 NaN 2 2]/3, ...
'YData',[0 1 NaN 0 1]);
% boxplot() some random data, for instance:
random_data = rand(10,3);
bp = boxplot(random_data);
% rescale the XData of the boxplot objects to be
% centered at 1/6, 1/2, 5/6 instead of 1, 2, 3:
for ii = 1:numel(bp)
set(bp(ii),'XData',(get(bp(ii),'XData')*2-1)/6);
end
% tick labels, etc.:
set(ax, ...
'XLim',[0 1], ...
'YLim',[0 1], ...
'XTick',[1 3 5]/6, ...
'XTickLabel',{'Sag','Frnt','Tran'}, ...
'Layer','top', ...
'FontSize',14);
title('Hip: : LFM R^2');
  댓글 수: 3
Voss
Voss 2022년 3월 22일
You're welcome!
Tomaszzz
Tomaszzz 2022년 3월 28일
Hi @_. I was trying to modify the code for my data but I am failing. I have posted a similar question here https://uk.mathworks.com/matlabcentral/answers/1682344-how-to-produce-a-grouped-errorbars just in case you would like to have a look.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by