Skip to main content
Added alternate form
Source Link
Bob Hanlon
  • 162.7k
  • 7
  • 81
  • 205

As a workaround

$Version

"12.1.1 for Mac OS X x86 (64-bit) (June 19, 2020)"

data = {{{1500, 4}, {1510, 4}, {1520, 4}, {1850, 6}}, {{1500, 1}, {18100, 1}}};

labels = {"a", "b"};

Show[
 ListPlot[#[[1]],
    PlotStyle -> ColorData[97][#[[2]]],
    PlotLabels -> #[[3]],
    Joined -> True] & /@
  Transpose[{data, Range[Length[data]], labels}],
 PlotRange -> All,
 AxesOrigin -> {0, 0}]

enter image description here

Alternatively,

Show[
 ListPlot[#1, 
    PlotStyle -> ColorData[97][#2], 
    PlotLabels -> #3, 
    Joined -> True] & @@@ 
  Transpose[{data, Range[Length[data]], labels}], 
 PlotRange -> All, 
 AxesOrigin -> {0, 0}]

As a workaround

$Version

"12.1.1 for Mac OS X x86 (64-bit) (June 19, 2020)"

data = {{{1500, 4}, {1510, 4}, {1520, 4}, {1850, 6}}, {{1500, 1}, {18100, 1}}};

labels = {"a", "b"};

Show[
 ListPlot[#[[1]],
    PlotStyle -> ColorData[97][#[[2]]],
    PlotLabels -> #[[3]],
    Joined -> True] & /@
  Transpose[{data, Range[Length[data]], labels}],
 PlotRange -> All,
 AxesOrigin -> {0, 0}]

enter image description here

As a workaround

$Version

"12.1.1 for Mac OS X x86 (64-bit) (June 19, 2020)"

data = {{{1500, 4}, {1510, 4}, {1520, 4}, {1850, 6}}, {{1500, 1}, {18100, 1}}};

labels = {"a", "b"};

Show[
 ListPlot[#[[1]],
    PlotStyle -> ColorData[97][#[[2]]],
    PlotLabels -> #[[3]],
    Joined -> True] & /@
  Transpose[{data, Range[Length[data]], labels}],
 PlotRange -> All,
 AxesOrigin -> {0, 0}]

enter image description here

Alternatively,

Show[
 ListPlot[#1, 
    PlotStyle -> ColorData[97][#2], 
    PlotLabels -> #3, 
    Joined -> True] & @@@ 
  Transpose[{data, Range[Length[data]], labels}], 
 PlotRange -> All, 
 AxesOrigin -> {0, 0}]
Source Link
Bob Hanlon
  • 162.7k
  • 7
  • 81
  • 205

As a workaround

$Version

"12.1.1 for Mac OS X x86 (64-bit) (June 19, 2020)"

data = {{{1500, 4}, {1510, 4}, {1520, 4}, {1850, 6}}, {{1500, 1}, {18100, 1}}};

labels = {"a", "b"};

Show[
 ListPlot[#[[1]],
    PlotStyle -> ColorData[97][#[[2]]],
    PlotLabels -> #[[3]],
    Joined -> True] & /@
  Transpose[{data, Range[Length[data]], labels}],
 PlotRange -> All,
 AxesOrigin -> {0, 0}]

enter image description here