Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

closed as off-topic by Dr. belisarius, Sjoerd C. de Vries, Nasser, m_goldberg, Artes Nov 3 '13 at 13:18

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

  • "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Dr. belisarius, Sjoerd C. de Vries, Nasser, m_goldberg, Artes
If this question can be reworded to fit the rules in the help center, please edit the question.

What trouble are you having? Did you use the Export command? What did you type? What error did you get? For additional information and – Nasser Nov 3 '13 at 6:48
Please add data to reproduce the plot and code/details to show us what your problem is. – Yves Klett Nov 3 '13 at 9:17
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. – 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

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

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