How to annotate multiple datasets in ListPlots

前端 未结 3 1760
时光取名叫无心
时光取名叫无心 2020-12-16 02:23

Frequently I have to visualize multiple datasets simultaneously, usually in ListPlot or its Log-companions. Since the number of datasets is usually larger than the number of

3条回答
  •  盖世英雄少女心
    2020-12-16 03:20

    One approach is to generate the plots separately and then show them together. This yields code that is more like yours than the other post, since PlotMarkers seems to play the way we expect when dealing with one data set. We can get the same coloring using ColorData with PlotStyle. Here's the result:

    ff = {Sin, Cos, Tan, Cot};
    plots = Table[ListLinePlot[ff[[i]] /@ Range[0.1, 10, 0.1],
        PlotStyle -> {ColorData[1, i]},
        PlotMarkers -> i, Mesh -> 22], {i, 1, Length[ff]}];
    (* Delete the spurious asymptote looking thingies. *)
    plots = DeleteCases[plots, Line[ll_?(Length[#] < 4 &)], Infinity];
    Show[plots, PlotRange -> {-4, 4}]
    

    enter image description here

提交回复
热议问题