# Filling area between two values

Hello,

``````When creating a simple plot with
``````

xs = [0.01*x for x in range(1000)]

``````ys = [x*x for x in xs]
``````

pyplot.fill_between(xs, ys)

``````The plot shows between x=0 and x=10, as expected.

However, when looking to fill between 2 and 8, in this way:

b = [False if x<2 or x>8 else True for x in xs]

pyplot.fill_between(xs, ys, where=b)

Then the plot shows between x=0 and x=8. Is there a way to get it to
``````

show up to x=10? Thanks,

``Albert``

pyplot.gca().set_xlim([0, 10])

···

2014-09-07 13:20 GMT+02:00 Albert Yiamakis <vkicefire@…287…>:

Hello,

``````When creating a simple plot with

xs = [0.01*x for x in range(1000)]

ys = [x*x for x in xs]

pyplot.fill_between(xs, ys)

The plot shows between x=0 and x=10, as expected.

However, when looking to fill between 2 and 8, in this way:

b = [False if x<2 or x>8 else True for x in xs]

pyplot.fill_between(xs, ys, where=b)

Then the plot shows between x=0 and x=8. Is there a way to get it to
``````

show up to x=10? Thanks,

``````Albert
``````

Slashdot TV.

Video for Nerds. Stuff that matters.

http://tv.slashdot.org/

Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users