plotyy set random paired linestyles

4 views (last 30 days)
Edward Byers
Edward Byers on 24 May 2013
I have two sets of data to plot on plotyy.
When I plot d1 & d2, I want d1(:,1) to have the same colour and linestyle as d2(:,1). I want further matching columns in d1 & d2 (i.e. d1(:,x),d2(:,x)) to have the same properties as each other, but different to other columns.
In other cases I have done this using a loop:
mrk={'o','s','*','v','+','^'} %These are the markers I want to use
for n=1:6
hold all
set(gca(),'linestyle',mrk(n))
plot(d1(:,n))
end
I could plot d2 at the end of the loop, but then I don't know how to customise the axes to make a plot become a plotyy.
What I would like to do is something like this (which doesn't work)
mrk={'o','s','*','v','+','^'}
set(gca(),'linestyleorder',mrk)
[ax,h1,h2] = plotyy(2010:2050,d1,2010:2050,d2)
Alternatively I have tried to set the linestyles using the handles, which also I cannot do... i.e.:
set(h1(n),'linestyle',mrk(n))
Unfortunately, as you can see I still have a poor understanding of all the properties,and where one can or cannot be used.
I have managed this with colours, but not markers/linestyles by using
set(gca,'colororder',mycolororder);
Thanks!
  1 Comment
Edward Byers
Edward Byers on 24 May 2013
Worked it out
for n=1:6
set(h1(n),'markersize', 5,'linestyle',mrk{n})
set(h2(n), 'markersize', 5,'linestyle',mrk{n})
end
Just needed to use curly brackets for the cell-structure - doh!

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!