Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
SysBiOThe
/
CRA-Matlab
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit eaa03183
authored
2019-03-31 21:19:59 +0200
by
Chiara Antonini
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Upload new file
1 parent
ba6d9e4d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
0 deletions
CRA_Updated_Version/Classes/figura_boxplot.m
CRA_Updated_Version/Classes/figura_boxplot.m
0 → 100644
View file @
eaa0318
%% boxplot_label_edit_example_for_file_exchange.m
%
% Michael Serafino
% created 6/5/13
%
% This code shows how to change the position of the text labels for the
% boxplot function. It also shows how to make the changes persist and
% resize when the figure is resized.
%
% This code was inspired by the following:
%
% 1.
% "When using box plot, why do I lose changes in text annotation positions
% when resizing my figure in MATLAB 7.8 (R2009a)?"
% http://www.mathworks.com/support/solutions/en/data/1-A8WRLK/index.html?product=ML&solution=1-A8WRLK
%
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
%plot
b
=
boxplot
(
MIRIT
);
ylabel
(
'MIRI'
);
%get the text labels
textobjs
=
findobj
(
gca
,
'type'
,
'text'
);
%set(textobjs,'Interpreter','tex');
%rotate the text
%set(textobjs,'rotation',45);
%change the font size
set
(
textobjs
,
'fontsize'
,
15
);
for
t
=
1
:
39
for
i
=
1
:
size
(
b
,
1
)
set
(
b
(
i
,
t
),
'linewidth'
,
2.5
);
end
end
%change the position of the text
offset_amount
=
[
0
-
3
0
];
temptextpositions
=
get
(
textobjs
,
'position'
);
for
n
=
1
:
length
(
textobjs
)
set
(
textobjs
(
n
),
'position'
,
get
(
textobjs
(
n
),
'position'
)
+
offset_amount
);
end
%this makes it so that the labels will stay in the same relative position
%on the figure, scaling when the figure is resized
set
(
textobjs
,
'units'
,
'data'
);
%code from source 1. This does something conceptually equivalent to
%removing the link that the text has to the boxplot, creating a copy of the
%text, and deleting the original text. (correct me if I'm wrong).
copyobj
(
textobjs
,
gca
);
delete
(
textobjs
);
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment