points2axes

버전 1.2.0.1 (18.4 KB) 작성자: Jorg Woehl
Conversion factors between points and axis units
다운로드 수: 13
업데이트 날짜: 2021/5/6

View points2axes on File Exchange

points2axes

points2axes calculates the conversion factors between points and axis units along the three Cartesian axes.

Purpose

The conversion factors are useful for drawing objects whose characteristic dimensions such as width, length, height, diameter, etc. are best expressed in points, where 1 point = 1/72 of an inch.

Note that changing the size of the figure window or the limits, orientation, or aspect ratio of the axes directly affects the conversion factors. It is therefore recommended to set the axis limits before calling points2axes to prevent them from changing when new objects are added.

Usage

[xppt, yppt, zppt] = points2axes calculates the conversion factors between points and axis units along the three Cartesian axes for the current axes. xppt is the number of x axis units that corresponds to a length of 1 point on the screen. Similarly, yppt and zppt are the number of y and z axis units per point, respectively.

[xppt, yppt, zppt] = points2axes(ax) calculates the conversion factors for the axes specified by ax instead of the current axes.

Limitations

Logarithmic plots of any kind are not supported.

Conversion factors for perspective projections are position-dependent and therefore do not have unique values. In this case, the conversion factors for the corresponding orthographic projection are returned (which gives sensible results in most cases) and a warning is issued.

Example

% create figure and axes
figure; ax = axes; ax.Clipping = 'off';
xlim([-1 1]); ylim([-2 2]); zlim([-3 3]);   % set axis limits
view(3); daspect([2 3 5]);                  % set 3D view and data aspect ratio

% calculate conversion factors
[xppt,yppt,zppt] = points2axes;

% draw lines that are 40 points in length
line([-20*xppt 20*xppt], [0 0], [0 0]);
line([0 0], [-20*yppt 20*yppt], [0 0]);
line([0 0], [0 0], [-20*zppt 20*zppt]);

This creates three 40 point long lines in the center of a 3D plot.

example-image

Requirements

points2axes is compatible with MATLAB R2018a and later releases.

Feedback

Any feedback or suggestions for improvement are welcome!

인용 양식

Jorg Woehl (2024). points2axes (https://github.com/JorgWoehl/points2axes/releases/tag/v1.2.0.1), GitHub. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2021a
R2018a 이상 릴리스와 호환
플랫폼 호환성
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.2.0.1

See release notes for this release on GitHub: https://github.com/JorgWoehl/points2axes/releases/tag/v1.2.0.1

1.1

See release notes for this release on GitHub: https://github.com/JorgWoehl/points2axes/releases/tag/v1.1

1.0

이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.
이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.