I have a table with values that I would like to add as dots to a chart. A simple example:

F1[x_] := Log[x]
F2[x_] := Log[1 - x]
Table1 = Table[{F1[x], F2[x]}, {x, 0.01, 0.99, 0.01}]
F3[x_] := 0.6*Log[x]
F4[x_] := Log[1 - x] - 1.5
Table2 = Table[{F3[x], F4[x]}, {x, 0.01, 0.99, 0.01}];
dot1 = {Table2[[1]]}
dot2 = {Table2[[2]]};
dot3 = {Table2[[3]]};
ListLinePlot[{Table1, dot1, dot2, dot3}, Ticks -> {None}, 
 AxesOrigin -> {Min[Table1[[All, 1]]], Min[Table1[[All, 2]]]}, 
 PlotLegends -> {"Frontier", "dot1", "dot2"}, 
 AxesLabel -> {"x", Row[{F}]}, 
 PlotStyle -> {Pink, {Black, Thickness[0.02]}, {Blue, 
    Thickness[0.02]}, {Red, Thickness[0.02]}}]

enter image description here Instead of adding this dots manually as I did, is there a smarter way to call them in a loop or using a function that evaluates all possible values of Table2?

  • $\begingroup$ "all possible values of Table2" Table2 has 99 points. If all are plotted, many will too close together to distinguish. So do really want that? And do you want a legend showing 99 points, each with own color? $\endgroup$ – m_goldberg Nov 11 '17 at 2:05
  • $\begingroup$ Indeed in my example would not be good to plot all of the dots. But I would still want to know how to call the dots from the list. $\endgroup$ – Laura K Nov 11 '17 at 18:24

I'm not at all sure I understand your question, but given what understanding I have, I recommend a different approach to incorporating the information you want to display into your plot. The approach I feel would be better involves using Callout for identifying plot elements. I also recommend using a labeled frame rather than labeled axes.

Because using full set points crowds the plot too much, I start by subsampling Table2.

pts = Table2[[1 ;; -1 ;; 10]];
n = Length[pts];

Next I build the callouts for the dots.

dots = Table[{Callout[pts[[i]], Row[{"dot", i}]]}, {i, n}];

Now I build the plot.

      Callout[Table1, "Frontier", {-.5, -.5}],
      PlotStyle -> Pink,
      Frame -> True],
    PlotRangePadding -> Scaled[.06],
    ImageSize -> 450],
  {"x", "F"}, {Bottom, Left}]


This plot shows all the information that you requested to be in the plot and shows it in a way that I think makes it easier for the viewer to absorb it than the way you described in your question.

  • $\begingroup$ That is great, @m_goldberg. That is exactly what I wanted. Thank you! $\endgroup$ – Laura K Nov 11 '17 at 18:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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