Borrar filtros
Borrar filtros

How to remove the horizontal line at 0

35 visualizaciones (últimos 30 días)
Curious Mind
Curious Mind el 4 de Feb. de 2021
Respondida: David Hill el 5 de Feb. de 2021
Hi All,
  1. How do I get rid of the horizontal line at the zero (0) mark on the y-axis in a line plot? Please see attached image below as an example. I want the horizontal line hidden.
2. How do I superimpose a barchart on a line plot?
Thank you all.
  3 comentarios
Curious Mind
Curious Mind el 5 de Feb. de 2021
Hi, thanks for the comments. I have something like this:
Plot(x,y)
y=0 is not even part of the code but for some reason it shows up in the plot.
Walter Roberson
Walter Roberson el 5 de Feb. de 2021
Please save x and y to a mat file and attach the file here for us to test.
You can get that kind of output if your x values are not in strict monotonic order.

Iniciar sesión para comentar.

Respuesta aceptada

David Hill
David Hill el 5 de Feb. de 2021
x=1:10;
y=randi(20,1,10)-10;
b=bar(x,y);
ax=gca;%to access axes properties
hold on
plot(x,y,'r*--')
b.ShowBaseLine='off'

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by