1
$\begingroup$

I produced a plot using

Show[
  ListPlot[{{1.1,3.9},{2.9,3.1}},
    Axes->None,Frame->{{True,False},{True,False}},PlotRange->{{1,3},{3,4}}
  ],
  "FrameTicks"->{{1,2,3},{{3,"low"},{4,"high"}}}
]

and I wanted to save the plot to a pdf. To save the plot I enter the line

Export["plot.pdf",<xxx>];

and I copied the plot and pasted where the <xxx> is. However, when I go to open the pdf, the y axes are missing. Why is this? Is there a workaround?

$\endgroup$

closed as off-topic by Alexey Popkov, garej, LCarvalho, MarcoB, J. M. is away Sep 7 '17 at 2:49

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Alexey Popkov, garej, LCarvalho, MarcoB, J. M. is away
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ You can also use Edit | Copy As | Bitmap $\endgroup$ – Bob Hanlon Sep 1 '17 at 15:20
3
$\begingroup$

You use deprecated syntax for FrameTicks. Also, FrameTicks should be specified as a Symbol, not as a String. The correct syntax form is FrameTicks -> {{left,right},{bottom,top}}:

Show[ListPlot[{{1.1, 3.9}, {2.9, 3.1}}, Axes -> None, 
  Frame -> {{True, False}, {True, False}}, PlotRange -> {{1, 3}, {3, 4}}], 
 FrameTicks -> {{{{3, "low"}, {4, "high"}}, None}, {{1, 2, 3}, None}}]

plot

With this I have no problem exporting the plot as PDF (Mathematica 11.1.1).

$\endgroup$
2
$\begingroup$

I do not know why the y axis is missing in the pdf, but I do know a workaround. One workaround is to simply use a variable to store the plot in and then export the variable:

plot=Show[
  ListPlot[{{1.1,3.9},{2.9,3.1}},
    Axes->None,Frame->{{True,False},{True,False}},PlotRange->{{1,3},{3,4}}
  ],
  "FrameTicks"->{{1,2,3},{{3,"low"},{4,"high"}}}
];
Export["plot.pdf",plot];

An even better solution is to follow the example given in this answer: generate the plot using the command

ListPlot[{{1.1,3.9},{2.9,3.1}},
  Axes->None,Frame->{{True,False},{True,False}},PlotRange->{{1,3},{3,4}},
  FrameTicks->{{{{3,"3.0"},{4,"4.0"}},None},{{1,2,3},None}}
]

(Notice the frame ticks are specified in a different form than you gave in your question.) Then you get the correct pdf both when you copy and paste the plot into the Export command or when you store the plot in a variable.

$\endgroup$

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