First time here? Check out the FAQ!

Ask Your Question
0

Fill between two curves

asked 12 years ago

xoviat gravatar image

I am attempting to fill the area between two curves. To more clearly illustrate what I am trying to accomplish, I would like to represent the area of the following integral:

integrate x-x^2 from 0 to 1

I can currently show the area under x with fill=True, but this is not what I want. What I want is for the fill to extend only to x^2 rather than all the way down to the x axis.

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
2

answered 12 years ago

kcrisman gravatar image

See here for a slew of fill options. Probably one of these will fit your needs.

sage: plot(x,(x,0,1),fill=x^2)
sage: plot([x,x^2],(x,0,1),fill={0:[1]})
Preview: (hide)
link
3

answered 12 years ago

ppurka gravatar image

Use a dict {<index of first curve>: [<index of second curve>]}, like this:

sage: plot([x, x^2], fill={0:[1]})

See the plot documentation for more examples.

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 12 years ago

Seen: 3,571 times

Last updated: Mar 29 '13