Change Width for YAxis (both) but not the grid

5 ビュー (過去 30 日間)
Tiago Dias
Tiago Dias 2019 年 5 月 2 日
コメント済み: Star Strider 2019 年 5 月 3 日
Hello,
I want to change both YAxis Width but ax1.YAxis.Linewidth = 1.5 command doesnt work. I would like the width of both Yaxis be the same as XAxis, while remaining the grid vertical and horizontal lines like in the plot i attached.
% Plot the coefficients Scaled
out = figure;
set(out,'PaperUnits','centimeters','PaperPosition',[0 0 29 21], 'PaperOrientation','landscape');
yyaxis left
bar(Lasso_coefficient_order_scaled)
yyaxis right
plot(count_coefficient_Lasso(Lasso_index_order),'O','MarkerFaceColor','black','MarkerEdgeColor','black','MarkerSize',6)
xlim([0 size(Lasso_sum_coefficients,2)+1]) % esthetics -> To get an extra space in the plot for the last variable (+1)
set(gca, 'XTickLabel', var_list2);
xticks(1:1:size(var_list2,2));
xtickangle(90);
title('Lasso');
xlabel('Variables','FontWeight','bold')
grid on; ax = gca; ax.XAxis.LineWidth = 1.5;
yyaxis(ax,'left');
set(ax,'YColor',[0 0 0]);
ylabel('Coefficients Importance','FontWeight','bold')
yticks(0:5:100);
ax1 = gca;
yyaxis(ax1,'right')
set(ax1,'YColor',[0 0 0])
ylabel('Number of Selections');
when i use
ax.YAxis.LineWidth = 1.5;
The following error ocurrs:
Expected one output from a curly brace or dot indexing expression, but there were 2 results.
Error in function_metric (line 343)
ax.YAxis.LineWidth = 1.5;
Thanks for the help

採用された回答

Star Strider
Star Strider 2019 年 5 月 2 日
That is a bit more complicated than it would otherwise appear to be.
This works in my test plot:
ax(1).YAxis(1).LineWidth = 1.5;
ax(2).YAxis(2).LineWidth = 1.5;
  2 件のコメント
Tiago Dias
Tiago Dias 2019 年 5 月 2 日
oh ok, I was trying just YAxis(1) and YAxis(2), not chaning also the ax(1) and ax(2)
thanks
Star Strider
Star Strider 2019 年 5 月 3 日
As always, my pleasure.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by