Stackedplot axes XLabel = ('Raman shift [cm^{-1}]') (superscript) not working

3 ビュー (過去 30 日間)
Raphael
Raphael 2022 年 3 月 17 日
移動済み: Adam Danz 2025 年 4 月 9 日
Dear community,
I was working on some figures with ln1 = stackedplot and tried to use the same label for my x-axes as I did when using ln1 = plot. So when using plot I can add the line ax1.XLabel = ('Raman shift [cm^{-1}]') and this shows what I want. Using stackedplot prints exactly this term 'Raman shift [cm^{-1}]', so I have to use '1/cm' instead. Do you know how to use superscript inside the axes label for stackedplot?

採用された回答

Dave B
Dave B 2022 年 3 月 17 日
編集済み: Dave B 2022 年 3 月 17 日
Unfortunately stackedplot doesn't let you control the interpreter for the XLabel, so you can't use tex like you can for a regular axes.
A workaround: put the stackedplot inside a 1 by 1 tiledlayout, and label the tiledlayout instead:
t=tiledlayout(1,1);
nexttile
stackedplot(rand(10,3))
xlabel(t,'Raman shift [cm^{-1}]')
Notes:
  • The default FontSize for a TiledChartLayout's label is a bit bigger, but you can change it.
  • If you want to adjust the position of the stackedplot, you'll instead need to adjust the position of the TiledChartLayout (t)
  5 件のコメント
Dave B
Dave B 2022 年 3 月 19 日
@Raphael - glad it's working, sorry the workflow is so painful!
Standalone visualizations like stackedplot provide a limited set of options (so you don't get the full feature set that you would with a regular axes) but in exchange they provide some richer features (like the interactive multi-axes datatip line thingy that stackedplot provides). They can be a real time-saver for some visualizations, but when you reach a feature that's not incorporated (like tex interpreted labels) it can be pretty frustrating and you have to get into this sort of workaround space.
Ron
Ron 2024 年 2 月 3 日
移動済み: Adam Danz 2025 年 4 月 9 日
I want to use the subscript for the labels bitnthe mentioned method is not able to solve the problem. It will be really gratful if anyone can help me out. Please help me.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAxes Appearance についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by