FixTicks tries to automate creating a custom number (either minimum or exact) of ticks on any axis. A simple algorithm will try to automatically determine a reasonable spacing. Ticks will try to include the limits if they are nicely rounded and an even number of ticks will always include zero (if present).
Actions such as zooming and setting an axis limit can cause ticks to be lost and make plots look bad. Equally some plotting functions such as plotyy and using subplots cause a figure to have less ticks than usual. The usual proposed solution is to set the ticks manually (set(ga,'YTicks',linspace(lb,ub,5)), however this solution creates non-intelligent spacing unless you want to micromanage all your ticks. You want nice rounded ticks automatically! Simply invoke:
fixticks();
after you're done plotting and setting limits etcetera, and voilà your Y-axis ticks are again nice!
Trough arguments (all are optional) you can control the behaviour. By default it will draw 5 ticks at minimum on the Y-axis of the current graphic object. Full arguments are as follows: fixticks(h, ax, ticknum, strict), where h (=gca) is the handle to the desired graphic object (for instance when using plotyy!), ax (='Y') allows to specify the desired axis, ticknum (=5) set the minimum or exact number of ticks, for strict (=false) being set to false or true, respectively.
引用
Jacco (2024). FixTicks - automatic redraw ticks on any axis (https://www.mathworks.com/matlabcentral/fileexchange/55921-fixticks-automatic-redraw-ticks-on-any-axis), MATLAB Central File Exchange. 取得済み .
MATLAB リリースの互換性
プラットフォームの互換性
Windows macOS Linuxカテゴリ
- MATLAB > Graphics > Formatting and Annotation > Axes Appearance > Limits, Ticks, and Grids > Grid Lines, Tick Values, and Labels >
- MATLAB > Graphics > 2-D and 3-D Plots > Line Plots > Two y-axis >
タグ
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!バージョン | 公開済み | リリース ノート | |
---|---|---|---|
1.0.0.0 | typos |