单个图上的多个Y轴 Octave.

问题描述 投票:1回答:1

我想做的是创造一些像这样的东西。

plot

我使用Octave的pcolor和barh函数创建了3个子图,子图的x轴按比例缩放,看起来就像一个图一样。然而,这种方法并不令人满意,因为我不能像在一个图中那样进行缩放或平移。

如何使用pcolor绘制一个背景图,然后在沿x轴的不同点添加多个y轴,使用barh绘制水平直方图?

对于这个问题的一些背景,我正试图创建一个所谓的市场概况图,即参见 例子此处.

我也在Octave邮件列表中交叉发布了这个问题。此处.

plot histogram octave axes
1个回答
0
投票

我已经找到了一个方法来实现我想要的东西。不使用barh函数,可以使用填充函数来代替。

下面给出一个最小的、可重复的例子。

## create y and x axes for chart
y_max = max( high_round ) + max_tick_range * tick_size ;
y_min = min( low_round ) - max_tick_range * tick_size ;
y_ax = ( y_min : tick_size : y_max )' ;
end_x_ax_freespace = 5 ;

x_ax = ( 1 : 1 : numel( open ) + end_x_ax_freespace )' ;
colormap( 'viridis' ) ; pcolor( x_ax , y_ax , vp_z' ) ; shading interp ; axis tight ;

## plot the individual volume profiles
hold on ;
scale_factor = 0.18 ; 
fill( vp( 1 , : ) .* scale_factor , y_ax' , [99;99;99]./255 ) ; 
fill( vp( 2 , : ) .* scale_factor .+ 50 , y_ax' , [99;99;99]./255 ) ;
fill( vp( 3 , : ) .* scale_factor .+ 100 , y_ax' , [99;99;99]./255 ) ;

hold off;

更多细节 我的博客文章。

© www.soinside.com 2019 - 2024. All rights reserved.