how can I change the line properties of a figure?
14 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a .fig file,that has more than 1 graphs in it. I want to change each one's color and LineStyle. how can I do that? assume that the figure has 3 graphs.
2 comentarios
José-Luis
el 29 de En. de 2014
Have you tried the figure editor? Or do you want to do it programatically?
Respuestas (2)
Mischa Kim
el 29 de En. de 2014
As an alternative, open the figure, change it according to your requirements and generate the corresponding MATLAB code via File > Generate Code...
This will give you, amongst others, a good idea on how to programmatically change figure properties.
Iain
el 29 de En. de 2014
Theres no one obvious, quick fix.
get the properties of the figure:
fig_props = get(fig_no);
fig_props will contain the handles to each axis in the figure, and some annotations, colormaps, etc. get the properties of each child of fig_props:
child_props_556 = get(fig_props.Children(556))
That will be an axis or something else, you can tell by inspecting the properties. An axis will have more children, some of which will be the plotted lines.
Interrogate the axis's children:
possible_line_prperties = get(child_props_556.Children(2))
If you're happy that child_props_556.Children(2) (or whatever) is the line with properties that you want to change, then you can simply set it's properties.
set(child_props_556.Children(2),'Marker','x')
You will need to apply some intelligence and adaptability to figure out exactly how to do what you want to do.
1 comentario
Iain
el 29 de En. de 2014
Each of those functions can be used programattically, you just need to know what's going on in the figures.
Ver también
Categorías
Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!