Fill transparency with log x axis
9 ビュー (過去 30 日間)
古いコメントを表示
Hi all,
I am trying to make a plot with three semi-transparent fill areas. I require a log x-axis. It's not a problem getting this to work on a linear axis but the transparency disappears when you change to a log scale. Try:
figure;
theAxis = gca;
set(theAxis,'NextPlot','add');
%plot three shapes
t = (1/16:1/8:1)'*2*pi;t = t';
for i=1:3
x = sin(t)+i;
n = cos(t)+i;
h = fill(x,n,'r');
set(h,'FaceAlpha',0.5);
end
%pause to view
pause(2);
%now change to log scale on the x-axis and the transparency disappears
set(theAxis,'XScale','log');
pause(2);
%and change back and the transparency reappears
set(theAxis,'XScale','linear');
Any ways to get the transparency to work on a log scale plot? Thanks, Stephen
0 件のコメント
採用された回答
その他の回答 (1 件)
himura
2022 年 9 月 24 日
編集済み: himura
2022 年 9 月 24 日
Pretty late, but for any future perspn looking at this, the accepted anser basically says "it is not supported, here's a work around"
I am here to pitch another workaround, which is to simply setting the color to be lighter. The example code here is for semilogy(), but it works for semilogx() and loglog()
x_axes = -10:0.1:10;
y_axes = x_axes .^ 2;
semilogy(x_axes, y_axes, '*', Color = [0 0 1]); % without transparency
semilogy(x_axes, y_axes, '*', Color = [0.7 0.7 1]); % with "transparency". it only seems transparent, but not really
% or
semilogy(x_axes, y_axes, '*', 'Color', [0 0 1]); % without transparency
semilogy(x_axes, y_axes, '*', 'Color', [0.7 0.7 1]); % with "transparency". it only seems transparent, but not really
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Lighting, Transparency, and Shading についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!