Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm making an ErrorListPlot where the error bars are a different color then the markers and it works, however, the error bars are drawn in front of the markers and it looks funny. See the following example

data = {{#1, #2}, ErrorBar[#3]} & @@@ RandomReal[1, {10, 3}];
Needs["ErrorBarPlots`"]
ErrorListPlot[
 data,
 PlotRange -> All,
 BaseStyle -> AbsoluteThickness[2],
 PlotStyle -> RGBColor[159/255, 158/255, 204/255],
 PlotMarkers -> {{Graphics@{Opacity[1], Darker@Blue, Disk[]}, 0.01
     5}}
 ]

enter image description here

See how the error bars are drawn over the markers. I want them to be behind. I tried to use Epilog to redraw the markers but they don't have a uniform aspect ratio.

Epilog -> ({Opacity[1], Darker@Blue, Disk[#, 0.025]} & /@ data[[All, 1]])

enter image description here

share|improve this question
    
@belisarius Thanks, I forgot that. –  s0rce Jul 14 '13 at 16:01

2 Answers 2

up vote 2 down vote accepted

1

A little improvement of Your approach would be using Point instead of Disk:

ErrorListPlot[data, PlotRange -> All, PlotStyle -> Orange,  PlotMarkers -> None,
              Epilog -> ({Darker@Blue, PointSize@.03, Point@data[[All, 1]]})],
              BaseStyle -> AbsoluteThickness[2]]

enter image description here

2

Not so obvious and I'm not sure if universal for ErrorListPlot but:

plot = ErrorListPlot[data, PlotRange -> All, BaseStyle -> AbsoluteThickness[2],   
                 PlotMarkers -> {{Graphics@{Opacity[1], Darker@Blue, Disk[]}, 0.01 5}},
                 PlotStyle -> Orange];

plot// Replace[#, k_List :> Reverse@k, {6}] &

enter image description here

less handy but more safe(?):

plot /. GraphicsComplex[x_, y_, z___] :> 
        GraphicsComplex[x, Replace[y, k_List :> Reverse@k, {3}], z]
share|improve this answer

The most obvious ...

data = {{#1, #2}, ErrorBar[#3]} & @@@ RandomReal[1, {10, 3}];
Needs["ErrorBarPlots`"]
Show[ErrorListPlot[data, PlotRange -> All, 
                         BaseStyle -> AbsoluteThickness[2], 
                         PlotStyle -> RGBColor[159/255, 158/255, 204/255], 
                         PlotMarkers -> None], 
     ListPlot[data[[All, 1]], 
                         PlotStyle -> Directive[PointSize[Medium], Red]]]

Mathematica graphics

share|improve this answer
    
Thanks, in the end I accepted Kuba's answer since his/hers didn't require plotting twice, although the overhead of yours wasn't really relevant. –  s0rce Jul 14 '13 at 20:59
    
@s0rce *his :-) –  Kuba Jul 14 '13 at 22:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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