I am trying to export a graph similar to the one attached as PDF. I am having troubles with the error bars and legends.

enter image description here

Is there a simple example someone can share and demonstrate how to do this?

  • 3
    $\begingroup$ What trouble are you having? Did you use the Export command? What did you type? What error did you get? For additional information reference.wolfram.com/mathematica/howto/ExportToPDF.html and reference.wolfram.com/mathematica/ref/format/PDF.html $\endgroup$ – Nasser Nov 3 '13 at 6:48
  • $\begingroup$ Please add data to reproduce the plot and code/details to show us what your problem is. $\endgroup$ – Yves Klett Nov 3 '13 at 9:17
  • $\begingroup$ Looking at the picture I'd say the problem is that some error bars are (partly) dropped. The one on the bottom of the plot exhibits an artifact. The problem with the legend is not readily apparent.I'm not sure about the color of the error bars. They should be in the color of the individual lines. $\endgroup$ – Sjoerd C. de Vries Nov 3 '13 at 10:38

The following works for me (Mathematica 9.0.1, Win7-64):


pl = 
  Table[{j Sqrt[i], Max[0.2, RandomReal[1]]}, {j, 1, 4}, {i, 10}], 
  Joined -> True, 
  PlotLegends -> 
   Placed[LineLegend[{"One fish", "Two fish", "Red fish", "Blue fish"}, 
                     LegendFunction -> Frame, 
                     Background -> White
          {Scaled[{0.03, 0.75}], {0, 0.5}}
  Frame -> True, 
  GridLines -> {None, Automatic}, 
  ImagePadding -> {{20, 10}, {20, 10}}

enter image description here


Export["C:\\yourPath\\plot.pdf", pl]

And here a screendump of the PDF as seen in Adobe Acrobat: enter image description here

  • $\begingroup$ thanks a lot this is great. What about the X axis? $\endgroup$ – Doron Nov 3 '13 at 18:33
  • $\begingroup$ @Doron. You're speaking in riddles. What's wrong with the x-axis? $\endgroup$ – Sjoerd C. de Vries Nov 3 '13 at 19:18
  • $\begingroup$ Sjored C. de Vries: you are right. Please excuse me it is all OK. $\endgroup$ – Doron Nov 3 '13 at 19:59

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