Fill transparency with log x axis
8 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
More Answers (1)
himura
on 24 Sep 2022
Edited: himura
on 24 Sep 2022
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 Comments
See Also
Categories
Find more on Lighting, Transparency, and Shading in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!