Borrar filtros
Borrar filtros

semilog x in boundedline doesn't work

3 visualizaciones (últimos 30 días)
T
T el 1 de Oct. de 2023
Comentada: Voss el 1 de Oct. de 2023
I tried multiple solutions offered, but once I make the x-axis logarithmic, the shading disappears.
for e.g. in this example
%% Example 1: Plotting lines using various syntax options
%
% This example builds the 4-panel example image used on the MatlabCentral
% File Exchange, which shows several different methods for supplying line
% coordinates, bounds coordinates, and shading options.
%
% The first axis plots two lines using the LineSpec option for input, which
% allows yoy to set line color, line color, and marker type for each line.
% The bounds on the first line vary over x, while the bounds on the second
% line are constant for all x. An outline is added to the bounds so the
% overlapping region can be seen more clearly.
x = linspace(0, 2*pi, 50);
y1 = sin(x);
y2 = cos(x);
e1 = rand(size(y1))*.5+.5;
e2 = [.25 .5];
ax(1) = subplot(2,2,1);
[l,p] = boundedline(x, y1, e1, '-b*', x, y2, e2, '--ro');
outlinebounds(l,p);
title('Opaque bounds, with outline');
axis tight;
The code works fine but if I add the line -
set(gca,'xscale','log')
in the end to make semilog x plot, the shading disappears. Any help is appreciated. Thanks!

Respuesta aceptada

Voss
Voss el 1 de Oct. de 2023
Editada: Voss el 1 de Oct. de 2023
The problem is the 0 in your x vector. Non-positive numbers cannot be represented on log scale. (Specifically, log(0) is negative infinity, which causes a problem drawing a patch with an infinite x-coordinate.) Change the zero to something small but positive.
x = linspace(1e-2, 2*pi, 50);
y1 = sin(x);
y2 = cos(x);
e1 = rand(size(y1))*.5+.5;
e2 = [.25 .5];
ax(1) = subplot(2,2,1);
[l,p] = boundedline(x, y1, e1, '-b*', x, y2, e2, '--ro');
outlinebounds(l,p);
title('Opaque bounds, with outline');
axis tight;
set(gca,'xscale','log')
  3 comentarios
T
T el 1 de Oct. de 2023
Thanks very much! :)
Voss
Voss el 1 de Oct. de 2023
You're welcome!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Volume Visualization en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by