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

42 次查看(过去 30 天)
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?

采纳的回答

darova
darova 2019-11-11
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 个评论
aweller3
aweller3 2019-11-11
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 2019-11-11
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").

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Object Identification 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by