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.Sat, 08 Jun 2019 15:32:59 +0200reverse y-axis graphhttps://ask.sagemath.org/question/46830/reverse-y-axis-graph/I'm sorry for asking trivial things, but I can't find this in the reference manual.
I have produced a graph by plotting a function simply by putting a minus sign in front of the function. But I actually want to reverse the axis to get positive values in the downward direction. Is it possible to achieve this?
(I am unable to post the graph, because my karma < 60)
w1_plot = plot(-w1_numerical, (x,0,3000), linestyle=":", gridlines=True, legend_label='$w_1$'
Thu, 06 Jun 2019 11:40:41 +0200https://ask.sagemath.org/question/46830/reverse-y-axis-graph/Comment by slelievre for <p>I'm sorry for asking trivial things, but I can't find this in the reference manual.
I have produced a graph by plotting a function simply by putting a minus sign in front of the function. But I actually want to reverse the axis to get positive values in the downward direction. Is it possible to achieve this?
(I am unable to post the graph, because my karma < 60)</p>
<pre><code>w1_plot = plot(-w1_numerical, (x,0,3000), linestyle=":", gridlines=True, legend_label='$w_1$'
</code></pre>
https://ask.sagemath.org/question/46830/reverse-y-axis-graph/?comment=46837#post-id-46837This is similar to a previously asked question:
- [Ask Sage question 46403: flipping a graph to plot upside down](https://ask.sagemath.org/question/46403)Thu, 06 Jun 2019 22:22:00 +0200https://ask.sagemath.org/question/46830/reverse-y-axis-graph/?comment=46837#post-id-46837Answer by Juanjo for <p>I'm sorry for asking trivial things, but I can't find this in the reference manual.
I have produced a graph by plotting a function simply by putting a minus sign in front of the function. But I actually want to reverse the axis to get positive values in the downward direction. Is it possible to achieve this?
(I am unable to post the graph, because my karma < 60)</p>
<pre><code>w1_plot = plot(-w1_numerical, (x,0,3000), linestyle=":", gridlines=True, legend_label='$w_1$'
</code></pre>
https://ask.sagemath.org/question/46830/reverse-y-axis-graph/?answer=46831#post-id-46831Add the keys `ymin` and `ymax` with suitable values. For example, compare the graphs given by
plot(x*sin(pi*x)^2, (x,0,2))
and
plot(x*sin(pi*x)^2, (x,0,2), ymin=2, ymax=0)Thu, 06 Jun 2019 13:37:00 +0200https://ask.sagemath.org/question/46830/reverse-y-axis-graph/?answer=46831#post-id-46831Comment by Markio for <p>Add the keys <code>ymin</code> and <code>ymax</code> with suitable values. For example, compare the graphs given by</p>
<pre><code>plot(x*sin(pi*x)^2, (x,0,2))
</code></pre>
<p>and</p>
<pre><code>plot(x*sin(pi*x)^2, (x,0,2), ymin=2, ymax=0)
</code></pre>
https://ask.sagemath.org/question/46830/reverse-y-axis-graph/?comment=46863#post-id-46863Thank you!Sat, 08 Jun 2019 15:32:59 +0200https://ask.sagemath.org/question/46830/reverse-y-axis-graph/?comment=46863#post-id-46863