2
$\begingroup$

I'm trying to insert a ragged line on a plot axis by using an inset. However, I always get white space around the inset such that my axis is broken at some point. What can I do to remove the white space?

Plot[x, {x, 0, 1}, ImageSize -> 300, 
Epilog -> {{Inset[
 Style[
  Graphics[
   {Thickness[0.02],
    Line[{{-0.1,0},{0,0},{0.2,0.2},{0.6,-0.2},{1,0.2},{1.2,0},{1.3,0}}]}, 
  ImageSize -> 15], 
  Background -> White],
  {0.5, 0}]}},
  ImagePadding -> 15,PlotRangeClipping -> False]

enter image description here

$\endgroup$
2
  • $\begingroup$ Is there a specific reason why you use this whole Inset[Style[Graphics[Line[...] ...]]] and not just give the graphics directive directly in Epilog, like Epilog -> {White, Rectangle[{0.475, -.1}, {.525, .1}], Black, Thickness[0.002], Line[...]}? $\endgroup$
    – Theo Tiger
    Commented Apr 5, 2018 at 13:04
  • $\begingroup$ There is no specific reason other than my limited knowledge about alternatives. $\endgroup$
    – Fabian
    Commented Apr 5, 2018 at 16:26

1 Answer 1

1
$\begingroup$

Just add PlotRangePadding -> 0, ImagePadding -> 0 to the inner Graphics object.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.