MATLAB Answers

Dashed lines showing up Solid

10 views (last 30 days)
Sophie Blankenheim
Sophie Blankenheim on 2 Dec 2020
Edited: VBBV on 2 Dec 2020
I'm trying to plot a set of data with fit lines that are solid for filled in data points and dashed for hollow data points, but when I run it all of the lines show up solid unless I switch it to solid lines for hollow data points, and dashed lines for filled in data points. I also tried including 'linestyle' to no avail as well as switching the colors.
subplot(1,2,2)
hold on
scatter(TDCases1(:,1),TDCases1(:,2),'k','o')%
scatter(DSCases1(:,1),DSCases1(:,2),'m','o','filled')
plot(TDCases1(:,1), f_TD,'--k')
[sortedDS, sortIds] = sort(DSCases1(:,1));
plot(sortedDS, f_DS(sortIds),'-m')
%ylim([0 aboveMax])
xlabel('Age (months)','Fontsize',14)
% ylabel(ygraphlabel,'Fontsize',14)
ylabel('Size','Fontsize',14)
hold off
title(['\fontsize{18}','S TD V DS fit - ', measureToAnalyze])
set(gca,'FontSize',14);
legend('TD','DS','Location','northwest')
set(gca,'FontSize',14);

Answers (1)

VBBV
VBBV on 2 Dec 2020
plot(TDCases1(:,1), f_TD,'--k')
hold on % use hold on between two plots
[sortedDS, sortIds] = sort(DSCases1(:,1));
plot(sortedDS, f_DS(sortIds),'-m')
hold on
use hold on between two plots
  4 Comments
VBBV
VBBV on 2 Dec 2020
what is size of vector f_TD ? May be its plotting multiple dashed lines, so it appears as solid line

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by