在 Octave 中绘制辅助 x 轴

发布于 2025-01-18 01:45:59 字数 168 浏览 2 评论 0原文

如何在标准X轴以下的八度的自定义标签中绘制辅助X轴?

最好的是拥有一个像“ ployxx”图的外观,但这在八度中不存在。

x=1:7
y=sin(x)
plot(x,y)
ht=text(1,-1.1,"22,150,160,150,140,150,22);

How can I plot a secondary x axis with my custom labels in Octave below the standard x axis?

The best would be to have a look like "ployxx" graph, but this does not exist in Octave.

x=1:7
y=sin(x)
plot(x,y)
ht=text(1,-1.1,"22,150,160,150,140,150,22);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

英雄似剑 2025-01-25 01:45:59

假设plotxx您的意思是类似于给定的示例在这里,这就是我的绘制方式:

% Create the data
  Salinity    = linspace( 32, 34, 100 );
  Temperature = linspace( 0 , 10, 100 );
  Depth_S     = linspace( 0, -100, 100 );
  Depth_T     = 50 * log( linspace( 0, 1, 100 ) );

% Explicitly create two axes
  Ax_S = axes();
  Ax_T = axes();

% Plot the two graphs into their respective axes
  plot( Ax_S, Salinity   , Depth_S, 'r', 'linewidth', 3 );
  plot( Ax_T, Temperature, Depth_T, 'b', 'linewidth', 3 );

% Set the axes to the same position, and change xaxis and yaxis locations,
 % colors, limits and other properties as desired
  set( Ax_S, 'position'     , [ 0.15, 0.15, 0.70, 0.70 ],
             'units'        , 'normalized'          ,
             'box'          , 'off'                 ,
             'fontsize'     , 16                    ,
             'linewidth'    , 2                     ,
             'xaxislocation', 'top'                 ,
             'xcolor'       , 'r'                   ,
             'yaxislocation', 'left'                ,
             'xlim'         , [ 32  , 34  ]         ,
             'ylim'         , [ -100, 0   ]         ,
             'xlabel'       , 'Salinity'            ,
             'ylabel'       , 'Depth (m)'             );

% For the axes on the 'top' of the stack, additionally make the background
 % color 'transparent' (by setting it to 'none')
  set( Ax_T, 'position'     , [ 0.15, 0.15, 0.70, 0.70 ],
             'units'        , 'normalized'          ,
             'box'          , 'off'                 ,
             'fontsize'     , 16                    ,
             'linewidth'    , 2                     ,
             'xaxislocation', 'bottom'              ,
             'xcolor'       , 'b'                   ,
             'yaxislocation', 'right'               ,
             'xlim'         , [ 0   , 10 ]          ,
             'ylim'         , [ -100, 0  ]          ,
             'xlabel'       , 'Temperature (C)'     ,
             'ylabel'       , 'Depth (m)'           ,
             'color'        , 'none'                   );

% Ensure the right 'stacking' order by calling the axes objects again in the
 % right order (from bottom to top)
  axes( Ax_S );
  axes( Ax_T );

Assuming by plotxx you mean something like the example given here, then this is how I would draw that:

% Create the data
  Salinity    = linspace( 32, 34, 100 );
  Temperature = linspace( 0 , 10, 100 );
  Depth_S     = linspace( 0, -100, 100 );
  Depth_T     = 50 * log( linspace( 0, 1, 100 ) );

% Explicitly create two axes
  Ax_S = axes();
  Ax_T = axes();

% Plot the two graphs into their respective axes
  plot( Ax_S, Salinity   , Depth_S, 'r', 'linewidth', 3 );
  plot( Ax_T, Temperature, Depth_T, 'b', 'linewidth', 3 );

% Set the axes to the same position, and change xaxis and yaxis locations,
 % colors, limits and other properties as desired
  set( Ax_S, 'position'     , [ 0.15, 0.15, 0.70, 0.70 ],
             'units'        , 'normalized'          ,
             'box'          , 'off'                 ,
             'fontsize'     , 16                    ,
             'linewidth'    , 2                     ,
             'xaxislocation', 'top'                 ,
             'xcolor'       , 'r'                   ,
             'yaxislocation', 'left'                ,
             'xlim'         , [ 32  , 34  ]         ,
             'ylim'         , [ -100, 0   ]         ,
             'xlabel'       , 'Salinity'            ,
             'ylabel'       , 'Depth (m)'             );

% For the axes on the 'top' of the stack, additionally make the background
 % color 'transparent' (by setting it to 'none')
  set( Ax_T, 'position'     , [ 0.15, 0.15, 0.70, 0.70 ],
             'units'        , 'normalized'          ,
             'box'          , 'off'                 ,
             'fontsize'     , 16                    ,
             'linewidth'    , 2                     ,
             'xaxislocation', 'bottom'              ,
             'xcolor'       , 'b'                   ,
             'yaxislocation', 'right'               ,
             'xlim'         , [ 0   , 10 ]          ,
             'ylim'         , [ -100, 0  ]          ,
             'xlabel'       , 'Temperature (C)'     ,
             'ylabel'       , 'Depth (m)'           ,
             'color'        , 'none'                   );

% Ensure the right 'stacking' order by calling the axes objects again in the
 % right order (from bottom to top)
  axes( Ax_S );
  axes( Ax_T );

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文