tie the size of the marker (in a 3D plot) to the scale of the axis
6 次查看(过去 30 天)
显示 更早的评论
Have a line in space (X, Y, Z); using scatter3(X,Y,Z) I can plot the line.
Using scatterr3(X,Y,Z,S) I can change the size of the markers according to the value of S.
my problem is that S is read in units of 'point squared' so that when I resize the image the relative size of the markers remains unchanged, but the "absolute" size (what I could infer from comparing the marker to the axis of the plot) goes all over the place.
I need to tie the 'as plotted' marker size to the scale of the axis. Either by defining the 'point' to be a certain number of axis units or by changing the units that scatter3 employs to draw the markers.
Is there a way to do that? how?
example:
scatter3([1:10], [1:10], [1:10], linspace(100,1000, 10))
produces a plot whe the last spherical marker is 10 times larger than the first, but the radius of the marker looks to be 0.5x (first image) or 0.1x (second image) units of the axis scale, depending on the "zoom factor" I apply to the plot.
I would like the radius to remain constant (same multiplier) with the axis scale.
0 个评论
回答(1 个)
Varun
2023-3-23
Hello!
As per my understanding, you want the size of the markers of the plot to be constant with respect to the axis scale so that they change when the plot’s zoom factor is modified. While there is no direct setting for this in MATLAB, a work-around to achieve this would be by plotting a “patch” at each point in the graph. This patch is defined via absolute coordinates, and thus, they would visibly change in size if the plot’s zoom factor is changed. You can find the documentation for patch at: https://www.mathworks.com/help/matlab/ref/patch.html#d124e1106990
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polygons 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!