2
$\begingroup$

I need to mark four points in a single graph, math does it separately, but when I put together both graphs, two points of a line disappear, I really do not know why.

(* first graph *)

w1 = ListLinePlot[ {{0, 88}, {24.2, 0}},
    Epilog -> {Red, PointSize@Large,Point[{{0, 88}, {24.2, 0}}]},
    Frame -> True, 
    FrameTicksStyle -> Black, 
    GridLines -> Automatic
]

(* second graph *)

w2 = ListLinePlot[ {{0, 25.3}, {88, 0}},
    Epilog -> {Red, PointSize@Large,Point[{{0, 25.3}, {88, 0}}]},
    Frame -> True, 
    FrameTicksStyle -> Black, 
    GridLines -> Automatic
]

(* combined graphs *)

Show[w1, w2, PlotRange -> All]

Any suggestion? plz :)

$\endgroup$

marked as duplicate by Michael E2 plotting Jul 12 at 14:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 3
    $\begingroup$ The Show inherits the Epilog from the first plot (w1). Move the Epilog to the Show: Show[w1, w2, PlotRange -> All, Epilog -> {Red, PointSize@Large, Point[{{0, 88}, {24.2, 0}, {0, 25.3}, {88, 0}}]}] $\endgroup$ – Bob Hanlon Jul 8 at 18:41
  • $\begingroup$ @MichaelE2 I have voted to reopen this question. While I totally agree with you, that for the general case of options and prologs/epilogs there are answers - this question is specifically asking for "points" in the epilog being lost. That use-case has a solution (cf. my answer) not yet demonstrated in the general answers you linked. $\endgroup$ – gwr Jul 12 at 18:30
  • $\begingroup$ @gwr Show[combineShow[w1, w2], PlotRange -> All] seems to do the job, no?: i.stack.imgur.com/BBvpw.png -- Mr.Wizard wrote combineShow specifically to address the problem of combining the Epilog and Prolog settings of graphics (but made it more general than that). $\endgroup$ – Michael E2 Jul 12 at 18:42
  • $\begingroup$ @MichaelE2 It certainly is addressing the problem (I never doubted that), but my point was and is: This is a very special case (points in the epilog) which does not need the whole shebang of Mr. Wizard's general solution. Using Mesh and Meshstyle works without all of that. $\endgroup$ – gwr Jul 15 at 10:14
  • 1
    $\begingroup$ @gwr Perhaps if the OP agreed to edit the question to focus on how to show data points along with graph, there would be support for reopening it. As it stands, I think the questions should be linked. Neither the Q or your answer is going away. Your answer is about a specific aspect of the general issue of Epilog that the OP seems interested in. My way for dealing with this has been to skip Epilog and put it all in Graphics, which seems both simple and obvious: Show[w1, w2, Graphics[{Red, PointSize@Large, Point[{{0, 88}, {24.2, 0}, {0, 25.3}, {88, 0}}]}]] $\endgroup$ – Michael E2 Jul 16 at 16:41
3
$\begingroup$

As Bob Hanlon has explained, Show will only inherit the options from the first element. You may consider working with Mesh and MeshStyle:

SetOptions[ ListLinePlot, Frame -> True, FrameTicksStyle -> Black, GridLines -> Automatic, Mesh -> All, MeshStyle -> Red];

w1 = ListLinePlot @ { {0, 88}, {24.2, 0} };
w2 = ListLinePlot @ { {0, 25.3}, {88, 0} };
Show[ w1, w2, PlotRange -> All ]

Show

$\endgroup$

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