0

cross posted on community.wolfram.com


I've noticed that in some situations the clipping is not done properly, despite the explicit setting PlotRangeClipping->True: So I plot some complex function:

Plot[{my function}, {M5, 0, 400}, PlotRange -> {{0, 400}, {0, 1500}}, 
 Frame -> True, 
 FrameTicks -> {{{0, 300, 600, 900, 1200, 1500}, 
    None}, {{0, 100, 200, 300, 400}, None}}, 
 FrameLabel -> {"Subscript[\[Mu], 5] (MeV)", "m (MeV)"}, 
 PlotStyle -> {{Black, Thickness[.007]}, {Black, Dashed}, 
   Black, {Black, Dashing[Tiny]}}, 
 PlotLabels -> Placed[{"+", "\[Sigma]", "-"}, {Scaled[0.6], Above}], 
 ImagePadding -> None]

Then I save it as EPS, and I insert in LATEX:

\begin{figure}[!htb]
\centering
\includegraphics[scale=.7]{plot.eps}
\caption{Digraph.}
\label{fig:digraph}
\end{figure}

And after that I do pdf. It displays as:

enter image description here

How may I solve this problem?

EDIT: SIMPLE EXAMPLE

Let

ListPlot[Table[{x, Sin[x]}, {x, -0.5, 6, 0.2}], 
 PlotRange -> {{0, 5.1}, {-1, 1}}, Frame -> True, 
 ImageSize -> {200, 150}, Joined -> True, 
 ImagePadding -> {{40, 5}, {40, 5}}, PlotRangeClipping -> True]
Export["zz.eps", %];

It displays good as enter image description here

Then I save it as EPS, to insert in LATEX:

\begin{figure}[!htb]
\centering
\includegraphics[scale=.7]{zz.eps}
\caption{Digraph.}
\label{fig:digraph}
\end{figure}

And after that I do pdf: enter image description here enter image description here

There are "whiskers". How may I remove it?

Kuba
  • 136,707
  • 13
  • 279
  • 740
illuminato
  • 299
  • 2
  • 9
  • What is the problem? Also: it is preferred style to generate the simplest example that illustrates your problem. Do we need to know about your FrameLabel (which you don't show)? Or PlotLabels? Or evan axes labels? – David G. Stork Mar 22 '17 at 20:18
  • this looks like an issue with whatever you are using to render the postscript. PlotRangeClipping is for other graphics you might add to the plot BTW. The actual plot lines I think are always clipped. – george2079 Mar 22 '17 at 20:30
  • There are situations when graphics elements will bleed slightly beyond the frame, but what you show here seems different and more serious. I tried a simple plot and I cannot reproduce the problem. Please show a complete but minimal example that illustrates the problem. Include the version of Mathematica you are using {$Version, $ReleaseNumber}. Note that despite what you said, there isn't an explicit PlotRangeClipping->True in your (incomplete) example. – Szabolcs Mar 22 '17 at 20:36
  • @David I add a example. – illuminato Mar 22 '17 at 20:51
  • @Szabolcs PlotRangeClipping->True is true by default for plots. My Mathematica is {"11.0.0 for Microsoft Windows (64-bit) (July 28, 2016)", 0} – illuminato Mar 22 '17 at 20:54
  • Yes, but you said "explicitly" :) In some cases that matters. I really don't think it does in this case, but you never know ... I am not convinced that what you show on the second image is the same problem as the one on the first. Look at the end of the black line intersecting the top frame. It's not cut horizontally. Regarding the problem shown in the second example: it's a common problem, but typically it's so subtle that it is not visible in print. However, I encourage you to report it to Wolfram Support anyway. I have complained about this in the past, but the more people complain ... – Szabolcs Mar 22 '17 at 21:17
  • ... the more likely that it will get fixed. What can you do in practice? 1. Always use Export, never right click, Save Graphics As... 2. Prepare figures to size. As I said, this is almost never visible at print sizes---provided you keep the figure at its original size and do not rescale in LaTeX. 3. You can export Magnify[fig,2] instead of fig, then shrink the result by 1/2. Warning: be sure the magnified image fits in your notebook width, otherwise there will be bad effects. I don't know a fix for this Magnify problem. – Szabolcs Mar 22 '17 at 21:21
  • Actually there is a way: set an explicit ImageSize in Graphics. Then you can Export[..., Magnify[fig, 5]], and then rescale the result to be 5x smaller. The bleeding beyond the frame will also be 5x smaller. – Szabolcs Mar 22 '17 at 21:24
  • @Szabolcs unfortunately it doesn't give better result. – illuminato Mar 23 '17 at 14:44
  • Another practical workaround you can try is to use thicker frames. FrameStyle -> Directive[AbsoluteThickness[1], Black]. But given that the imprecision is clearly smaller than 1 printer's point, i.e. 0.35 mm, are you sure that this is actually visible in print when preparing the figure to size? Also, are you sure that the problem you show in your first plot is the same as in the second one? I am not convinced about this. I suspect your first plot is affected by a different problem. But we can't help with it without an example. You could try to upload the Graphics expression somewhere. – Szabolcs Mar 23 '17 at 16:14

0 Answers0