MATLAB Answers

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

53 ビュー (過去 30 日間)
aweller3 2019 年 11 月 10 日
コメント済み: aweller3 2019 年 11 月 11 日
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?

  0 件のコメント



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
Yellow is gcf - figure
Green is gca - axes

  2 件のコメント

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 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 件)

Community Treasure Hunt

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

Start Hunting!

Translated by