Plotting scale bar with vertical margins

9 visualizaciones (últimos 30 días)
Dan Mirea
Dan Mirea el 24 de Mzo. de 2019
Comentada: Dan Mirea el 26 de Mzo. de 2019
I wanna plot horizontal scale bars with vertical margins like the ones in figure below that present the observation radius and the safe distance. Any method that works is much appreciated.

Respuesta aceptada

dpb
dpb el 24 de Mzo. de 2019
Editada: dpb el 24 de Mzo. de 2019
X=[0.2,0.1]; Y=[0.9,0.75]; E=[0.15,0.05]; % positions, bar length about midpint
hEb=errorbar(X,Y,E,'horizontal','b.', 'linewidth',1.5,'capwidth',10); % add scales
xlim([0 1]),ylim([0 1]) % just to set bounding limits on axis for viewing...
hTxt=text(X,Y,[{'Observation Radius'},{['Safe' char(10) 'Distance']}], ...
'horizontalalignment','center','verticalalignment','top','fontsize',8);
results in following which is reasonable approximation. Draw the other pieces, then hold on to add the errorbars. The '.' linestyle stops drawing line between the points; otherwise would have to add separate error bars.
untitled.jpg
NB: Must use the char(10) for the line break; \n is not interpreted as newline by default TeX interpreter.
  3 comentarios
dpb
dpb el 25 de Mzo. de 2019
Editada: dpb el 25 de Mzo. de 2019
It was introduced between R2014b and R2016b as was 'horizontal' orientation...don't have in-between version installed to check.
You can, of course, always just draw the line segments directly. Wouldn't take much to make a little function for the purpose.
Dan Mirea
Dan Mirea el 26 de Mzo. de 2019
Thanks a lot man, I managed to make it work by deleting the capwidth bit. Cheers!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by