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, 12 Apr 2012 16:26:27 +0200Contour Plots and Pointshttps://ask.sagemath.org/question/8584/contour-plots-and-points/Why can I not have a single point on a contour plot?
var('x,y')
f(x,y)=sin(x)*cos(y)
G = contour_plot(f(x,y),(x,-3,3),(y,-3,3),contours=20,plot_points=100)
G += point((1,1), size=100)
G.show()
does not display the point. I can add a line (for example)
G += line(((1.5,1),(1.5,0)))
and that line shows up but not the point.
Thanks.
JT Sun, 15 Jan 2012 21:39:31 +0100https://ask.sagemath.org/question/8584/contour-plots-and-points/Answer by travis for <p>Why can I not have a single point on a contour plot?</p>
<pre><code>var('x,y')
f(x,y)=sin(x)*cos(y)
G = contour_plot(f(x,y),(x,-3,3),(y,-3,3),contours=20,plot_points=100)
G += point((1,1), size=100)
G.show()
</code></pre>
<p>does not display the point. I can add a line (for example)</p>
<pre><code>G += line(((1.5,1),(1.5,0)))
</code></pre>
<p>and that line shows up but not the point.</p>
<p>Thanks.</p>
<p>JT </p>
https://ask.sagemath.org/question/8584/contour-plots-and-points/?answer=13126#post-id-13126Thanks.
Just to be certain, why does subsequently plotting a line without a zorder not put that line behind the contour plot as well?Mon, 16 Jan 2012 10:03:36 +0100https://ask.sagemath.org/question/8584/contour-plots-and-points/?answer=13126#post-id-13126Comment by Jason Grout for <p>Thanks. </p>
<p>Just to be certain, why does subsequently plotting a line without a zorder not put that line behind the contour plot as well?</p>
https://ask.sagemath.org/question/8584/contour-plots-and-points/?comment=19944#post-id-19944the same person that does now...the user who wants to submit a patch.Thu, 12 Apr 2012 16:26:27 +0200https://ask.sagemath.org/question/8584/contour-plots-and-points/?comment=19944#post-id-19944Comment by Jason Grout for <p>Thanks. </p>
<p>Just to be certain, why does subsequently plotting a line without a zorder not put that line behind the contour plot as well?</p>
https://ask.sagemath.org/question/8584/contour-plots-and-points/?comment=20531#post-id-20531it seems to make sense to have contour plots below other things generally. It would be great if someone came up with a comprehensive sensible default zorder for all of the graphics objects.Mon, 16 Jan 2012 17:16:57 +0100https://ask.sagemath.org/question/8584/contour-plots-and-points/?comment=20531#post-id-20531Comment by DSM for <p>Thanks. </p>
<p>Just to be certain, why does subsequently plotting a line without a zorder not put that line behind the contour plot as well?</p>
https://ask.sagemath.org/question/8584/contour-plots-and-points/?comment=20537#post-id-20537Unfortunately I don't understand the order in which things are drawn well enough to say what the order is when zorders aren't specified/things have the same zorder. Note that you can use the ".set_zorder" method on graphics objects to change it after-the-fact.Mon, 16 Jan 2012 11:13:11 +0100https://ask.sagemath.org/question/8584/contour-plots-and-points/?comment=20537#post-id-20537Comment by kcrisman for <p>Thanks. </p>
<p>Just to be certain, why does subsequently plotting a line without a zorder not put that line behind the contour plot as well?</p>
https://ask.sagemath.org/question/8584/contour-plots-and-points/?comment=20524#post-id-20524Agreed. But who will take the responsibility for user complaints that that zorder setup is wrong? Tue, 17 Jan 2012 11:19:22 +0100https://ask.sagemath.org/question/8584/contour-plots-and-points/?comment=20524#post-id-20524Answer by DSM for <p>Why can I not have a single point on a contour plot?</p>
<pre><code>var('x,y')
f(x,y)=sin(x)*cos(y)
G = contour_plot(f(x,y),(x,-3,3),(y,-3,3),contours=20,plot_points=100)
G += point((1,1), size=100)
G.show()
</code></pre>
<p>does not display the point. I can add a line (for example)</p>
<pre><code>G += line(((1.5,1),(1.5,0)))
</code></pre>
<p>and that line shows up but not the point.</p>
<p>Thanks.</p>
<p>JT </p>
https://ask.sagemath.org/question/8584/contour-plots-and-points/?answer=13124#post-id-13124The point *is* there -- it's simply lurking behind the contour plot. Or, in matplotlib jargon (one of the plotting packages Sage uses is called matplotlib), it doesn't have a higher zorder. The zorder is the layer level, where the layers are drawn from lower to higher.
I can never remember what zorders different things default to, but it's usually easily changed manually:
var('x,y')
f(x,y)=sin(x)*cos(y)
G = contour_plot(f(x,y),(x,-3,3),(y,-3,3),contours=20,plot_points=100)
G += point((1,1), size=100,zorder=2)
G.show()
produces
![image description](/upfiles/13266841032864173.png)
Sun, 15 Jan 2012 22:22:26 +0100https://ask.sagemath.org/question/8584/contour-plots-and-points/?answer=13124#post-id-13124