only one plot line is showing

2 次查看(过去 30 天)
%%plot1
subplot(1,2,1)
gscatter(labels_sorted, 1:N, binary); hold on
line([label_25 label_25], [0 n_25], 'Color', 'k')
line([0 label_25], [n_25 n_25], 'Color','k')
line([label_50 label_50], [round(N*0.5) round(N*0.5)])
xlabel('Performance')
ylabel('Circuit')
ha1 = gca;
ha1.XScale = 'log';
ha1.XAxis.Color = bcolor;
ha1.YAxis.Color = bcolor; % change the y axis color to black (not a dark grey)
ha1.XAxis.FontSize = fonttick; % change x tick font size
ha1.YAxis.FontSize = fonttick; % change y tick font size
ha1.XAxis.Label.FontSize = fontlabel; % change x label font size
ha1.YAxis.Label.FontSize = fontlabel; % change y label font size
ha1.Layer = 'top';
subplot(1,2,2)
gscatter(complexity_sorted, labels_sorted, binary)
xlabel('Complexity')
ylabel('Performance')
ha2 = gca;
ha2.YScale = 'log';
ha2.XAxis.Color = bcolor;
ha2.YAxis.Color = bcolor; % change the y axis color to black (not a dark grey)
ha2.XAxis.FontSize = fonttick; % change x tick font size
ha2.YAxis.FontSize = fonttick; % change y tick font size
ha2.XAxis.Label.FontSize = fontlabel; % change x label font size
ha2.YAxis.Label.FontSize = fontlabel; % change y label font size
ha2.Layer = 'top';
in plot 1, i am trying to add lines to denote quadrants, it plots the first line but not the rest.
  1 个评论
Anthony Sirico
Anthony Sirico 2022-12-20
The small point vice using 0 worked, thanks. As for the plotting of the point, is draws a line between the two points.
thanks for the help

请先登录,再进行评论。

采纳的回答

Bora Eryilmaz
Bora Eryilmaz 2022-12-20
编辑:Bora Eryilmaz 2022-12-20
There are two issues with your code. First,
line([label_50 label_50], [round(N*0.5) round(N*0.5)])
is a point, not a line. So you probably won't be able to see it.
Second, since you are setting the x-axis scale to logarithmic, the left end of the line that starts from x=0
line([0 label_25], [n_25 n_25], 'Color','k')
will map to -inf and that line won't show up anymore on the plot. You can use a small x value instead to be able to see it. Something like:
line([0.1 label_25], [n_25 n_25], 'Color','k')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Axis Labels 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by