How to change line style of a plotted graph?

Hello,
I would like to change the linestyle of a plotted graph for making color blind people to understand my graph. The graph is already plotted. I have no basic data (anymore), but only the saved figure. I tried the follwing:
hline = findobj(gcf, 'type', 'line')
set(hline(1),'LineStyle',':')
But that didnt seem to work.I added my graph.
Does anyone knows how to do this?
Roe

6 Kommentare

Thorsten
Thorsten am 17 Dez. 2014
You forgot to add the graph; and the saved figure file would also be helpful.
Roel
Roel am 17 Dez. 2014
Sorry, it is added now.
matt dash
matt dash am 17 Dez. 2014
Your code works fine for me on your graph. Make sure that "gcf" is indeed the figure you think it is (i.e. do you have other figures open too?)
Roel
Roel am 18 Dez. 2014
Mmm, i do not know what i am doing wrong. I have indeed only one figure open.I also cleared my workspace. Does other versions of matlab have influence maybe?
Roel
Roel am 18 Dez. 2014
I do manage to change the legend of the figure. But the plotted lines in the figure remain the same.
Roel
Roel am 18 Dez. 2014
I found my mistake, had to change 1 in hline(1) to 7,8 or 9. Thanks anyway.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 17 Dez. 2014

3 Stimmen

If we test this example
plot(1:44)
hline = findobj(gcf, 'type', 'line')
set(hline(1),'LineStyle','--')
It seems to work

Weitere Antworten (0)

Kategorien

Mehr zu Creating, Deleting, and Querying Graphics Objects finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 17 Dez. 2014

Kommentiert:

am 18 Dez. 2014

Community Treasure Hunt

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

Start Hunting!

Translated by