Ask Your Question
1

flipping a graph to plot upside down

asked 2019-04-29 19:39:45 +0100

stockh0lm gravatar image

Because in my special application positive values on my y-axis increase downwards instead of upwards.

So while normally you would do this:

x,y = var('x,y')
f(x,y) = x^2 + y^2
contour_plot(f, (x,0,1), (y,0,1)).show()

(where y plots from smaller numbers to bigger ones) I instead want to do this:

x,y = var('x,y')
f(x,y) = x^2 + y^2
contour_plot(f, (x,0,1), (y,1,0)).show()

where I expect the same picture, just flipped upside down. Except, this bombs! How can i get my desired result? the axis should be properly labeled, too.

edit retag flag offensive close merge delete

Comments

For reference, a similar question was asked again one month later:

slelievre gravatar imageslelievre ( 2019-06-06 22:23:09 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2019-04-29 21:01:54 +0100

This works for me:

x,y = var('x,y')
f(x,y) = x^2 + y^2
P = contour_plot(f, (x,0,1), (y,0,1))
P.set_axes_range(0, 1, 1, 0)
P.show()

So does this:

x,y = var('x,y')
f(x,y) = x^2 + y^2
P = contour_plot(f, (x,0,1), (y,0,1))
P.ymin(1)
P.ymax(0)
P.show()
edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-04-29 19:39:45 +0100

Seen: 363 times

Last updated: Apr 29 '19