1
$\begingroup$

I'd like to be able to add a line below the x-axis of my plot but not have the y-axis extending down to cover this region (as it defaults to).

For example:

    Plot[Sin[x]^2, {x, 0, 2 π}, 
         Epilog -> {Thickness[0.02],Line[{{0, -0.1}, {5, -0.1}}]},
         PlotRange -> {{0, 2 π}, {-0.1, 1}}]

enter image description here

I don't want the bit of y-axis between 0 and my Line object to be drawn. Frustrated to not be able to figure this one out myself, I'm convinced I'm missing something simple!

Cheers

$\endgroup$
4
  • $\begingroup$ Try using ImagePadding. $\endgroup$
    – MarcoB
    Nov 26, 2015 at 16:09
  • 2
    $\begingroup$ @MarcoB + PlotRangeClipping->False. $\endgroup$
    – Kuba
    Nov 26, 2015 at 16:15
  • 5
    $\begingroup$ closely related/duplicate 9346 $\endgroup$
    – Kuba
    Nov 26, 2015 at 16:16
  • $\begingroup$ Yup, I was being a fool. The addition of PlotRangeClipping->False and ImagePadding sorts it PROVIDED I remember to reset PlotRange to {{0,2pi},{0,1}}. Thanks, I'd already read that other qu several times but must have completely confused myself. $\endgroup$ Nov 26, 2015 at 17:00

0

Browse other questions tagged or ask your own question.