Merging 10 scatter plots produced with different RNG sequences

1 view (last 30 days)
Om
Om on 30 Mar 2016
Commented: Julian Hapke on 7 Apr 2016
Hi all
I have produced 10 scatter graphs which are similar and I wanted to merge the files into a scatter graph with range bars (i.e. Median, Upper Q, Lower Q)
I have the 10 figures saved as .fig and .m/.mat files.
Any tips for doing this please?

Answers (3)

Julian Hapke
Julian Hapke on 4 Apr 2016
you can access the data of each plot by
X=cell(10,1)
Y=X
for ii = 1:10
f = open('figure_ii.fig') % use the correct file names here
X{ii} = get(get(gca,'Children'),'XData')
Y{ii} = get(get(gca,'Children'),'YData')
close(f)
end
to calculate your new data use "quantile"
help quantile
also have a look at
help errorbar
to plot the ranges you calculated.
I hope this helps, otherwise you have to specify your question.

Om
Om on 4 Apr 2016
Basically, the values are saved in 10 files already (.mat)
There are 3 values saved in each file along each point of the x axis.
Matlab doesn't like me loading these individually as it over-writes the data.
I need to create a for loop that loads each file name and plots it on the scatter.
  1 Comment
Julian Hapke
Julian Hapke on 5 Apr 2016
I assume your variable names in each mat-file are the same, so if you just
load('example.mat')
it overrides your current values. So what you could do is just load your data into an array of structures:
data(10).median = []
data(10).lq = []
data(10).uq = []
for ii = 1:10
data(ii) = load('file.mat')
end
to get a vector of each array entry use
[data.median]
and so on

Sign in to comment.


Om
Om on 5 Apr 2016
Edited: Om on 5 Apr 2016
Have managed to load the files now and get the scatter loaded.
Just need to turn it all into error bars now so there isn't 10 lines for each colour only the one line with the median etc.
  2 Comments
Julian Hapke
Julian Hapke on 7 Apr 2016
you mentioned earlier, that each of your 10 mat files contains 3 values, so I don't understand where all the plots in your picture come from, enlighten me.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!