How to reproduce a figure?
5 views (last 30 days)
Show older comments
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?
0 Comments
Accepted Answer
Voss
on 22 Mar 2022
Edited: Voss
on 22 Mar 2022
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 Comments
More Answers (0)
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!