Plot two sets of markers in GUI

Hi,
I am creating a GUI. It displays a graph and marks a few indexes using plot and markers (upper image). now I want to mark again some of the previous indexes, but when I try to do so - all the first markers are deleted.
this is the first plot of a graph + markers:
"plot(handles.axesNS1, handles.sigNV(:,1), handles.sigNV(:,2), '-*','MarkerIndices', handles.presentedRRNS1, 'MarkerEdgeColor','red', 'MarkerSize', 6)"
It works fine and plots red markers (upper image). then I add the following command in the next row:
"plot(handles.axesNS1, handles.sigNV(:,1), handles.sigNV(:,2), 'o', 'MarkerIndices', handles.Missed_NS1, 'MarkerEdgeColor','black', 'MarkerSize', 7)"
and it deletes all red markers and displays just the black ones. (lower image)
how can I display this graph with both groups of markers one on each other?
Note: when I use the same method outside the GUI - it works fine and both markers appear.

Réponses (1)

Rik
Rik le 3 Déc 2018

0 votes

Use hold on or its equivalent: set the NextPlot axes property to 'add'.

2 commentaires

try
hold(handles.axesNS1,'on')
Rik
Rik le 4 Déc 2018
So if you use this:
plot(handles.axesNS1, handles.sigNV(:,1), handles.sigNV(:,2), '-*','MarkerIndices', handles.presentedRRNS1, 'MarkerEdgeColor','red', 'MarkerSize', 6)
set(handles.axesNS1,'NextPlot','add')
plot(handles.axesNS1, handles.sigNV(:,1), handles.sigNV(:,2), 'o', 'MarkerIndices', handles.Missed_NS1, 'MarkerEdgeColor','black', 'MarkerSize', 7)
that still results in the wrong result?
Try to make a MWE so we can run your code without any other dependencies and can reproduce your issue.

Cette question est clôturée.

Tags

Clôturé :

le 20 Août 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by