MATLAB Answers

How to change the middle line width in barh plot?

2 views (last 30 days)
Bruno
Bruno on 12 Feb 2018
Answered: KL on 12 Feb 2018
Hi,
I tried to change the middle line width in barh plot
using set(gca,'linewidth',3), this modifies the x and y-axis.
Any and all help is much appreciated!
figure
Y1 = 1:4;
Y2 = 5:8;
data = rand(4);
barh(Y1,(abs(data(:,1))),'r');
hold on
barh(Y2,(abs(data(:,2))),'g');
hold on
barh(Y1,(-(abs(data(:,3)))),'r')
hold on
barh(Y2,(-(abs(data(:,4)))),'g')
set(gca,'linewidth',3)
box off

  2 Comments

Star Strider
Star Strider on 12 Feb 2018
What is ‘the middle line’?
Please give an example of what you want the barh plot to look like.
Bruno
Bruno on 12 Feb 2018
Hi, I want to increase the width of the middle line in the barh plot

Sign in to comment.

Accepted Answer

KL
KL on 12 Feb 2018
You don't need to change the axis line thickness but simply plot a vertical line like,
plot([0 0],[0 10],'k','linewidth',3)

  0 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.