How do I draw barh using both axes values?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
farzad
el 27 de Abr. de 2020
Comentada: Walter Roberson
el 28 de Abr. de 2020
Hi All
How do I draw barh ( horizontal bars) taking into consideration both axes values : saying when 0<x<100 , draw a bar between 10<y<12
1 comentario
Respuesta aceptada
Walter Roberson
el 28 de Abr. de 2020
x_to_draw_at = x(0 < x & x < 100);
bar(x_to_draw_at, 12*ones(1,length(x_to_draw_at)), 'basevalue', 10)
4 comentarios
Walter Roberson
el 28 de Abr. de 2020
For values of ranges, by definition ranges <= max(ranges). When ranges is entirely positive, then max(ranges) is positive and max(ranges)*1.1 is even larger than max(ranges) so you can be sure that ranges < max(ranges)*1.1 .
So when could ranges < max(ranges)*1.1 be false?
- max(ranges) is 0, in which case 0*1.1 is 0, and 0 < 0 is false. On the other hand, the case of 0 is already eliminated by 0 < ranges
- max(ranges) is negative, in which case max(ranges)*1.1 is more negative, and it could be the case that there are some values that are more negative than max(ranges) but not as negative as max(ranges)*1.1. For example, -10.5 and -10, max() is -10, max()*1.1 is -11, and -10.5 < -11 is false. However, this can only happen for negative values, never for positive values, and you already eliminate negative values with 0 < ranges .
You should reconsider your test. Perhaps you want something like max(ranges)*0.9
by the way , the bars should be horizontal. does the code do this ?
You are going to need to describe what the output should look like: we as outsiders need to assume that the x values are not sorted and not continuous.
Más respuestas (0)
Ver también
Categorías
Más información sobre Lighting, Transparency, and Shading en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!