ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 06 Jun 2019 22:23:09 +0200flipping a graph to plot upside downhttps://ask.sagemath.org/question/46403/flipping-a-graph-to-plot-upside-down/ 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.
Mon, 29 Apr 2019 19:39:45 +0200https://ask.sagemath.org/question/46403/flipping-a-graph-to-plot-upside-down/Comment by slelievre for <p>Because in my special application positive values on my y-axis increase downwards instead of upwards. </p>
<p>So while normally you would do this:</p>
<pre><code>x,y = var('x,y')
f(x,y) = x^2 + y^2
contour_plot(f, (x,0,1), (y,0,1)).show()
</code></pre>
<p>(where y plots from smaller numbers to bigger ones) I instead want to do this:</p>
<pre><code>x,y = var('x,y')
f(x,y) = x^2 + y^2
contour_plot(f, (x,0,1), (y,1,0)).show()
</code></pre>
<p>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.</p>
https://ask.sagemath.org/question/46403/flipping-a-graph-to-plot-upside-down/?comment=46838#post-id-46838For reference, a similar question was asked again one month later:
- [Ask Sage question 46830: reverse y-axis graph](https://ask.sagemath.org/question/46830)Thu, 06 Jun 2019 22:23:09 +0200https://ask.sagemath.org/question/46403/flipping-a-graph-to-plot-upside-down/?comment=46838#post-id-46838Answer by John Palmieri for <p>Because in my special application positive values on my y-axis increase downwards instead of upwards. </p>
<p>So while normally you would do this:</p>
<pre><code>x,y = var('x,y')
f(x,y) = x^2 + y^2
contour_plot(f, (x,0,1), (y,0,1)).show()
</code></pre>
<p>(where y plots from smaller numbers to bigger ones) I instead want to do this:</p>
<pre><code>x,y = var('x,y')
f(x,y) = x^2 + y^2
contour_plot(f, (x,0,1), (y,1,0)).show()
</code></pre>
<p>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.</p>
https://ask.sagemath.org/question/46403/flipping-a-graph-to-plot-upside-down/?answer=46406#post-id-46406This 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()
Mon, 29 Apr 2019 21:01:54 +0200https://ask.sagemath.org/question/46403/flipping-a-graph-to-plot-upside-down/?answer=46406#post-id-46406