4

Starting with this example, I would like to do something very similar but being able to use negative values for variables in the code, for example;

menMeans   = (-20, 35, -30, 35, -27)
womenMeans = (25, -32, 34, -20, 25)

, although this has nothing to do with the men/women meaning. But when I do this, I can not see anything related with negative values in the plot. I also change Y scale;

plt.yticks(np.arange(-81,81,10))

but nothing. Any hints?

1
  • I see the negative values there just fine, making the same changes you have .. Commented Feb 17, 2013 at 12:06

2 Answers 2

2

I change the y axis scale by the following command:

plt.ylim([-81,81])

which will set the y axis scale from -81 to 81

for the x scale axis that would be

plt.xlim([ xmin,xmax])
Sign up to request clarification or add additional context in comments.

Comments

0

in the gallery example you find this line of code:

plt.bar(ind, womenMeans, width, color='y',bottom=menMeans, yerr=menStd)

the value for the bottom can be chosen negative so that the bar starts from somewhere negative and is womenMeans long.

a yellow bar from -200 to 20 at x=5 with width = 10

would be:

plt.bar(5, 220,10, color='y',bottom=-200)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.