I am facing a pretty random problem using JLink (Java) connected to a Mathematica 11.3 kernel and front-end.

Basically I want to get an image using the JLink Java method com.wolfram.jlink.KernelLink.evaluateToImage(command, 0, 0, 0, true)

This is the Mathematica command that I pass:

  Plot[Evaluate[plotVars /. Sols], {t,ti,tf}, 
    LabelStyle -> 
      {FontFamily -> Arial,FontWeight -> Bold, FontSlant -> Plain, FontSize -> 14}, 
    PlotLegends -> plotLegends, 
    Axes -> False, 
    Frame -> True, 
    PlotStyle -> 
        {Dashing[0.03 k1/Length[plotVars]], Thickness[0.006]}, 
        {k1, 1, Length[plotVars]}], 
    FrameLabel -> {"t", "Concentration"}, 
    PlotRange -> Full, 
    ImageSize -> 700],
  RasterSize -> 2000,

Most of the time I get the following image:

Plot with frames but neither ticks nor numbers

Other times, I get the usual image with ticks and numbers, and I don't understand why. Same code was tested on Mathematica 9.0 and 10.0 and never had this issue before. Problems are only faced with version 11.3.

This is the same code executed on a Mathematica 11.3 Notebook, it is showed correctly:

standard plot with ticks

With JLink sometimes I get this same image but I want to guarantee that I always get the image with ticks and numbers.

Maybe JLink/Front End needs some additional configuration?

Any help would be really appreciated!


1 Answer 1


I found the solution:

Usually in the Plot[] function, the FrameTicks option is set to Automatic, which in Mathematica 9.0 or 10.0 "always" translates to True. But for some reason in Mathematica 11.3 sometimes it is translated as None or True, which causes the stated random behaviour.

Solution: set manually the Plot[] option FrameTicks.


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.