plot axis based on a function found online
显示 更早的评论
I found the following function:
what do I not to do to be able to save that function to my matlab and is there a way somebody else who hasen't downloaded that file is still able to see what it's doing?
回答(1 个)
Walter Roberson
2013-3-29
At the bottom of that page there is a header
Related Documents/Files:
below which there is a link for drawaxis.m . Click on that link to download the file. Put the file in a convenient location on your MATLAB path.
Anyone who wishes to execute your code will need a copy of the file. You could include it along with your code.
9 个评论
Locks
2013-3-29
Walter Roberson
2013-3-29
It does not work on the basis of functions or individual lines: it works on the basis of axes, by examining the axes limits, which plotting automatically sets based on the range of values you plotted values over.
Locks
2013-3-29
Walter Roberson
2013-3-29
Use the command
pathtool
and ensure that the directory where you stored drawaxis.m is on the MATLAB path.
Once it is, then after you have done all your other plotting for the axis you want to affect, put the command in your code
drawaxis(gca, 'x', 0, 'movelabel', 1)
Locks
2013-3-29
Walter Roberson
2013-3-29
You did not follow the instructions to "set axis limits appropriately".
YL = get(gca, 'YLim');
YL(1) = min(0, YL(1));
YL(2) = max(0, YL(2));
set(gca, 'YLim', YL);
Note: you might find that once the above is done that you do not need to use drawaxis()
Locks
2013-3-29
编辑:Walter Roberson
2013-3-30
Walter Roberson
2013-3-30
Are you getting an error message? I do not have the toolbox with blsprice() in it, so I cannot test your code.
Locks
2013-3-30
类别
在 帮助中心 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!