Skip to main content
ups. Put the wrong color into my code. ;)
Source Link
Jinxed
  • 3.8k
  • 10
  • 24

You can use the following construct to draw the error bars yourself using any collection of geometric shapes available:

(* starting out with defining some points, errors etc. *)
pts = NestList[{#[[1]] + 1, #[[2]] + RandomReal[{0., 1.}]} &, {0, 
                RandomReal[]}, 19];
err = RandomReal[4, 20];
data = Table[{pts[[i, 1]], pts[[i, 2]], err[[i]]}, {i, 1, Length@pts}];

hw = 1; (* the width of the ticks *)
ErrorListPlot[data, ErrorBarFunction -> Function[{coords, errs}, {
  (* the vertical line: *)
  Line[{coords - {0, errs[[2, 1]]/2}, coords + {0, errs[[2, 1]]/2}}],
  (* horizontal tick 1: *)
  {Green,Thick,Line[{coords-{hw/2, -errs[[2, 1]]/2}, coords+{hw/2, errs[[2, 1]]/2}}]},
  (* horizontal tick 2: *)
  {GreenRed,Thick,Line[{coords-{hw/2, errs[[2, 1]]/2}, coords+{hw/2, -errs[[2, 1]]/2}}]}
}]]

Example:

hw==1

You can use the following construct to draw the error bars yourself using any collection of geometric shapes available:

(* starting out with defining some points, errors etc. *)
pts = NestList[{#[[1]] + 1, #[[2]] + RandomReal[{0., 1.}]} &, {0, 
                RandomReal[]}, 19];
err = RandomReal[4, 20];
data = Table[{pts[[i, 1]], pts[[i, 2]], err[[i]]}, {i, 1, Length@pts}];

hw = 1; (* the width of the ticks *)
ErrorListPlot[data, ErrorBarFunction -> Function[{coords, errs}, {
  (* the vertical line: *)
  Line[{coords - {0, errs[[2, 1]]/2}, coords + {0, errs[[2, 1]]/2}}],
  (* horizontal tick 1: *)
  {Green,Thick,Line[{coords-{hw/2, -errs[[2, 1]]/2}, coords+{hw/2, errs[[2, 1]]/2}}]},
  (* horizontal tick 2: *)
  {Green,Thick,Line[{coords-{hw/2, errs[[2, 1]]/2}, coords+{hw/2, -errs[[2, 1]]/2}}]}
}]]

Example:

hw==1

You can use the following construct to draw the error bars yourself using any collection of geometric shapes available:

(* starting out with defining some points, errors etc. *)
pts = NestList[{#[[1]] + 1, #[[2]] + RandomReal[{0., 1.}]} &, {0, 
                RandomReal[]}, 19];
err = RandomReal[4, 20];
data = Table[{pts[[i, 1]], pts[[i, 2]], err[[i]]}, {i, 1, Length@pts}];

hw = 1; (* the width of the ticks *)
ErrorListPlot[data, ErrorBarFunction -> Function[{coords, errs}, {
  (* the vertical line: *)
  Line[{coords - {0, errs[[2, 1]]/2}, coords + {0, errs[[2, 1]]/2}}],
  (* horizontal tick 1: *)
  {Green,Thick,Line[{coords-{hw/2, -errs[[2, 1]]/2}, coords+{hw/2, errs[[2, 1]]/2}}]},
  (* horizontal tick 2: *)
  {Red,Thick,Line[{coords-{hw/2, errs[[2, 1]]/2}, coords+{hw/2, -errs[[2, 1]]/2}}]}
}]]

Example:

hw==1

colored
Source Link
Jinxed
  • 3.8k
  • 10
  • 24

You can use the following construct to draw the error bars yourself using any collection of geometric shapes available:

(* starting out with defining some points, errors etc. *)
pts = NestList[{#[[1]] + 1, #[[2]] + RandomReal[{0., 1.}]} &, {0, 
                RandomReal[]}, 19];
err = RandomReal[4, 20];
data = Table[{pts[[i, 1]], pts[[i, 2]], err[[i]]}, {i, 1, Length@pts}];

hw = 1; (* the width of the ticks *)
ErrorListPlot[data, ErrorBarFunction -> Function[{coords, errs}, {
  (* the vertical line: *)
  Line[{coords - {0, errs[[2, 1]]/2}, coords + {0, errs[[2, 1]]/2}}],
  (* horizontal tick 1: *)
  {Green,Thick,Line[{coords - {hw/2, -errs[[2, 1]]/2}, coords + coords+{hw/2, errs[[2, 1]]/2}}]},
  (* horizontal tick 2: *)
  {Green,Thick,Line[{coords - {hw/2, errs[[2, 1]]/2}, coords + coords+{hw/2, -errs[[2, 1]]/2}}]}
}]]

Example:

hw==1hw==1

You can use the following construct to draw the error bars yourself using any collection of geometric shapes available:

(* starting out with defining some points, errors etc. *)
pts = NestList[{#[[1]] + 1, #[[2]] + RandomReal[{0., 1.}]} &, {0, 
                RandomReal[]}, 19];
err = RandomReal[4, 20];
data = Table[{pts[[i, 1]], pts[[i, 2]], err[[i]]}, {i, 1, Length@pts}];

hw = 1; (* the width of the ticks *)
ErrorListPlot[data, ErrorBarFunction -> Function[{coords, errs}, {
  (* the vertical line: *)
  Line[{coords - {0, errs[[2, 1]]/2}, coords + {0, errs[[2, 1]]/2}}],
  (* horizontal tick 1: *)
  Line[{coords - {hw/2, -errs[[2, 1]]/2}, coords + {hw/2, errs[[2, 1]]/2}}],
  (* horizontal tick 2: *)
  Line[{coords - {hw/2, errs[[2, 1]]/2}, coords + {hw/2, -errs[[2, 1]]/2}}]
}]]

Example:

hw==1

You can use the following construct to draw the error bars yourself using any collection of geometric shapes available:

(* starting out with defining some points, errors etc. *)
pts = NestList[{#[[1]] + 1, #[[2]] + RandomReal[{0., 1.}]} &, {0, 
                RandomReal[]}, 19];
err = RandomReal[4, 20];
data = Table[{pts[[i, 1]], pts[[i, 2]], err[[i]]}, {i, 1, Length@pts}];

hw = 1; (* the width of the ticks *)
ErrorListPlot[data, ErrorBarFunction -> Function[{coords, errs}, {
  (* the vertical line: *)
  Line[{coords - {0, errs[[2, 1]]/2}, coords + {0, errs[[2, 1]]/2}}],
  (* horizontal tick 1: *)
  {Green,Thick,Line[{coords-{hw/2, -errs[[2, 1]]/2}, coords+{hw/2, errs[[2, 1]]/2}}]},
  (* horizontal tick 2: *)
  {Green,Thick,Line[{coords-{hw/2, errs[[2, 1]]/2}, coords+{hw/2, -errs[[2, 1]]/2}}]}
}]]

Example:

hw==1

image etc.
Source Link
Jinxed
  • 3.8k
  • 10
  • 24

You can use the following construct to draw the error bars yourself using any collection of geometric shapes available:

(* starting out with defining some points, errors etc. *)
pts = NestList[{#[[1]] + 1, #[[2]] + RandomReal[{0., 1.}]} &, {0, 
                RandomReal[]}, 19];
err = RandomReal[4, 20];
data = Table[{pts[[i, 1]], pts[[i, 2]], err[[i]]}, {i, 1, Length@pts}];

hw = 1; (* the width of the ticks *)
ErrorListPlot[data, ErrorBarFunction -> Function[{coords, errs}, {
  (* the vertical line: *)
  Line[{coords - {0, errs[[2, 1]]/2}, coords + {0, errs[[2, 1]]/2}}],
  (* horizontal tick 1: *)
  Line[{coords - {hw/2, -errs[[2, 1]]/2}, coords + {hw/2, errs[[2, 1]]/2}}],
  (* horizontal tick 2: *)
  Line[{coords - {hw/2, errs[[2, 1]]/2}, coords + {hw/2, -errs[[2, 1]]/2}}]
}]]

Example:

hw==1

You can use the following construct to draw the error bars yourself using any collection of geometric shapes available:

hw = 1; (* the width of the ticks *)
ErrorListPlot[data, ErrorBarFunction -> Function[{coords, errs}, {
  (* the vertical line: *)
  Line[{coords - {0, errs[[2, 1]]/2}, coords + {0, errs[[2, 1]]/2}}],
  (* horizontal tick 1: *)
  Line[{coords - {hw/2, -errs[[2, 1]]/2}, coords + {hw/2, errs[[2, 1]]/2}}],
  (* horizontal tick 2: *)
  Line[{coords - {hw/2, errs[[2, 1]]/2}, coords + {hw/2, -errs[[2, 1]]/2}}]
}]]

You can use the following construct to draw the error bars yourself using any collection of geometric shapes available:

(* starting out with defining some points, errors etc. *)
pts = NestList[{#[[1]] + 1, #[[2]] + RandomReal[{0., 1.}]} &, {0, 
                RandomReal[]}, 19];
err = RandomReal[4, 20];
data = Table[{pts[[i, 1]], pts[[i, 2]], err[[i]]}, {i, 1, Length@pts}];

hw = 1; (* the width of the ticks *)
ErrorListPlot[data, ErrorBarFunction -> Function[{coords, errs}, {
  (* the vertical line: *)
  Line[{coords - {0, errs[[2, 1]]/2}, coords + {0, errs[[2, 1]]/2}}],
  (* horizontal tick 1: *)
  Line[{coords - {hw/2, -errs[[2, 1]]/2}, coords + {hw/2, errs[[2, 1]]/2}}],
  (* horizontal tick 2: *)
  Line[{coords - {hw/2, errs[[2, 1]]/2}, coords + {hw/2, -errs[[2, 1]]/2}}]
}]]

Example:

hw==1

Source Link
Jinxed
  • 3.8k
  • 10
  • 24
Loading