Plot only every n'th dot, change from figure menu without extracting the data
Infos
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Afficher commentaires plus anciens
I have a figure with many curves on it. I wish to change the frequency of the dots only for some of the curves. Is there a way to do this directly (and simply) from the figure menum or the properties of the curve? Namely without having to extract the data into arrays (I only have the figure, not the original *.mat file)?
Réponses (2)
Ameer Hamza
le 8 Juin 2018
Modifié(e) : Ameer Hamza
le 8 Juin 2018
Yes, you can do that uses axes and line handles. For example, open the figure and run
ax = gca
it will give you the axes handle. If you then try
ax.Children
you will see an array of lines like this
ans =
2×1 Line array:
Line
Line
You can then change the XData and YData of each line individually. For example, to delete even index elements from the first line, try
ax.Children(1).XData(2:2:end) = [];
ax.Children(1).YData(2:2:end) = [];
Steven Lord
le 8 Juin 2018
0 votes
If you're using release R2016b or later, use the findobj or findall functions to find the handle of the object created by plot then set the MarkerIndices property of that handle or those handles.
Cette question est clôturée.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!