MATLAB Answers

plotyy: changing the line-style to 'o--'

119 views (last 30 days)
Abhinav on 31 May 2018
Commented: Abhinav on 1 Jun 2018
I have three line-plots on left y-axis and a bar plot on the right y-axis. how do I change line-style to 'o--' for every line on left y-axis. I am using following code, but it shows an error of 'Bad property value found'.
set(hl1,'linestyle','--','linewidth',3) % gives error if I use 'o--' instead of '--'
datetick(Ax(1),'x','mmmm dd')
datetick(Ax(2),'x','mmmm dd HH:MM')
I have attached the figure that I get with this code and other formattings. I am not able to figure out a way to change the line style of blue-curve to 'o--' as in other cases.
Abhinav on 1 Jun 2018
Thank you, Stephen! It worked.

Sign in to comment.

Accepted Answer

Greg on 1 Jun 2018
'o--' and others are shortcut inputs to plot commands when you don't pass a parameter. In this case, you are specifying a marker and a line style. When you pass the 'LineStyle' parameter, you can't include a marker identifier (the 'o'). Try:

More Answers (0)



Community Treasure Hunt

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

Start Hunting!