在 Scilab 中使用条形图是否有任何直接的方法或解决方法来显示条形旁边的数据标签?
Scilab 图表:
我想在 Scilab 图表中实现的带有数据标签的示例图表。我没有找到任何选项,但可能有解决方法吗?
这是一个与您的案例类似的注释示例,带有分组条:
[x, y] = ([1 2 5], [1 -5 6;3 -2 7;4 -3 8]);
h = bar(x, y);
txy = h.children.data; // get bars raw coordinates
// tune x coordinates inside groups
txy(:,1) = txy(:,1) + h.children.x_shift'(:) - h.children(1).bar_width/2;
// get Text height to tune y coordinates for labels below the bars for y<0 bars
th = xstringl(1,1,"8")(4);
// Display values
t = xstring(txy(:,1),txy(:,2)- th*(txy(:,2)<0), string(txy(:,2))+".0");
// reframe the plot to show the value for the highest bar
replot
结果: