How to find the handle of all markers in plot (already made)?

65 views (last 30 days)
I am learning about plotting in Octave and I wanted to set the marker size of all markers in a plot I already made using plot (using default plot function in Octave 5.1.0 - not sure if it is gnuplot or another one-how to I find this or do I need to specify it to start with?). I want to use the set function to set the marker size, but I need a handle to interact with the markers. Using set(gca,"markersize",16) for instance gives an error that the property "markersize" doesn't exist.
The markers I'm using (no lines) are all different styles like "x","o","+",etc and colors. I was able to get the handle of one style using h=findobj(gca,"marker","x"), and then set the "x" marker size from there. However, I don't know how to do this for all makrers. I have also tried h=findall(gca,"type","marker") to no avail.
How do I set the marker size of all markers at once? Also, is there a list of all object types? The Matlab help pages for findobj and findall only listed a few types of objects in the examples.
I also have a couple of general questions if you don't mind answering (or pointing me to a good resource to learn from): What does it mean when it displays the handle is equal to a number (e.g. h=findobj(...) then Octave displays h=-29.776)? What is the difference between gca and gcf?

Accepted Answer

darova
darova on 11 Nov 2019
To set up markerSize to every marker try:
h = get(gca,'children');
for i = 1:length(h)
if strcmp(get(h(i),'type'),'line') % check if it's a line
set(h(i),'markersize',10);
end
end
Yellow is gcf - figure
Green is gca - axes
img1.png
set(gcf,'color','y')
set(gca,'color','g')
  2 Comments
aweller3
aweller3 on 11 Nov 2019
Thank you for taking the time to respond! Give me a couple hours and I will try it out.
Your diagram of gcf and gca makes perfect sense thanks.
aweller3
aweller3 on 11 Nov 2019
It works perfectly thank you! It seems the markers (even without apparent lines attached) are considered "type" == "line", which I did not expect. This is good to know. h=get(gca,'children') got the handles of all the objects I needed (for octave I replaced 'children' with "children").

Sign in to comment.

More Answers (0)

Categories

Find more on Graphics Object Identification in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!