0
$\begingroup$

I want to add an inset with a graphics-primitive in a ListPlot. This should be fairly simple: First the inset is defined:

    line = Graphics[{Directive[Black, AbsoluteThickness[0.5]], Rotate[Line[{{-1/2, -(1/4)}, {1/2, 1/4}}], \[Pi]/2]}]

Then this inset is put into a ListPlot.

plotwithinset = 
 ListPlot[{}, Axes -> False, Frame -> False, PlotRange -> {{0, 500}, {0, 5}}, ImageSize -> 500, Epilog -> {Inset[line, {250, 2.5}, {0, 0}, 20]}]

The line should now be visible in the middle of the plot. But this is not the case. If I change the size of the line it becomes visible inside the plot, but it is butchered (see on the top left):

line = Graphics[{Directive[Black, AbsoluteThickness[0.5]], Rotate[Line[{{-10/2, -(10/4)}, {10/2, 10/4}}], \[Pi]/2]}]

enter image description here

This butchering changes with the size of the line and also with the size of the plot. It even changes the position, where the line is, which means this butchering takes place before the graphic is actually placed inside the plot.

I think this is some form of optimization in mathematica compareable to MaxPlotsPoints. If the graphic is small compareable to the plotrange (here 1/2 compared to 500) mathematica does not care to display it correctly and the resizing done by inset is then sizing up a butchered version. But to make the graphic larger is in my opinion no satisfying solution, because it is no general solution. Any ideas?

$\endgroup$
2
  • $\begingroup$ The line should now be visible in the middle of the plot. But this is not the case. in V 13.1 it does show in the middle as expected. Screen shot !Mathematica graphics $\endgroup$
    – Nasser
    Commented Sep 24, 2022 at 16:22
  • $\begingroup$ Also see 264891 as this seems like a similar artifact. It is the (invisible) frame that is chopping the graphic. $\endgroup$
    – Syed
    Commented Sep 24, 2022 at 16:45

0

Your Answer

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

Browse other questions tagged or ask your own question.