# How to plot these errorbars of x-axis to be logarithmic with ErrorListLogLinearPlot?

Mathematica Asked by Axion Ahn on December 31, 2020

data = {{{8.9053, 0.332061}, ErrorBar[(14.4292 - 3.3245)/2, (0.423087 - 0.241563)/2]}, {{1.49645, 0.619758}, ErrorBar[(0.788969 - 0.4541078)/2]}, {{1.310, 0.0}, ErrorBar[(1.73756 - 0.86043)/2, (0.57853 - 0.0)/1]}, {{0.89608, 0.510028}, ErrorBar[(0.579105 - 0.440952)/2]}, {{0.33885, 0.610708}, ErrorBar[(0.42503 - 0.252973)/2, (0.699667 - 0.522424)/2]}};
data2 = data /. {{{x_, y_},
ErrorBar[err_, err_]} :> {{{x, y}, Around[{x, err}, {y, err}]}}};
ErrorListLogLinearPlot[data2, PlotRange -> {{0.1, 18}, {0.25, 0.75}}, Frame -> True, FrameLabel -> {"x", "y"}, LabelStyle -> Directive[Bold, Medium], PlotStyle -> Directive[Red, Medium]]


data = {{{8.9053, 0.332061},
ErrorBar[(14.4292 - 3.3245)/2, (0.423087 - 0.241563)/2]}, {{1.49645,
0.619758}, ErrorBar[(0.788969 - 0.4541078)/2]}, {{1.310, 0.0},
ErrorBar[(1.73756 - 0.86043)/2, (0.57853 - 0.0)/1]}, {{0.89608, 0.510028},
ErrorBar[(0.579105 - 0.440952)/2]}, {{0.33885, 0.610708},
ErrorBar[(0.42503 - 0.252973)/2, (0.699667 - 0.522424)/2]}};


None of your ErrorBar match the pattern {{x_, y_}, ErrorBar[err_, err_]}; so no replacements are made. It is unclear what you are trying to do on the RHS of the replacements. Assuming that there are separate errors for x and y when two values are given and equal errors when only one is given:

data2 = data /. {{{x_, y_}, ErrorBar[errx_, erry_]} :> {Around[x, errx],
Around[y, erry]},
{{x_, y_}, ErrorBar[err_]} :> {Around[x, err], Around[y, err]}}


Once you convert to using Around, just use ListLogLinearPlot

ListLogLinearPlot[data2, PlotRange -> {{0.1, 18}, {0.25, 0.75}},
Frame -> True, FrameLabel -> {"x", "y"},
LabelStyle -> Directive[Bold, Medium], PlotStyle -> Directive[Red, Medium]]


Answered by Bob Hanlon on December 31, 2020