gpt4 book ai didi

wolfram-mathematica - Wolfram Mathematica : y-axis frame labels are not aligned

转载 作者:行者123 更新时间:2023-12-04 05:58:36 30 4
gpt4 key购买 nike

我正在 Mathematica 中生成一个双面板图形。底部面板在 y 轴上具有负值,这会导致该轴上的标签(使用 FrameLabel 生成)比顶部面板上的标签向左对齐,后者具有正值。我无法将面板连接到单个图,因为比例不同。
一段重现问题的代码:

pad = 80;
Export["C:\\Users\\user\\Desktop\\stackoverflow.png",
Column[
{
Show[
Plot[ Sin[x]^2, {x, 0, Pi},
FrameLabel -> {"", "y"},
BaseStyle -> {FontSize -> 16, FontWeight -> Bold,
FontFamily -> "Calibri"},
ImagePadding -> {{pad, pad/4}, {pad, pad/4}},
Frame -> {True, True, True, True}
]
, ImageSize -> 640]
,
Show[
Plot[ -Sin[x]^2/1000, {x, 0, Pi},
FrameLabel -> {"x", "y"},
BaseStyle -> {FontSize -> 16, FontWeight -> Bold,
FontFamily -> "Calibri"},
ImagePadding -> {{pad, pad/4}, {pad, pad/4}},
Frame -> {True, True, True, True}
]
, ImageSize -> 640]
}
]
]

此代码生成下图,您可以在其中看到 y 标签在顶部和底部面板中对齐不同。
misaligned y labels

我将不胜感激 - 我必须尽快将数字(显然不是上面的数字...)提交给出版商,以便我的论文进行打印...
谢谢

最佳答案

我通过用 Inset 替换 FrameLabel 解决了这个问题:

Column[
{
Show[
Plot[ Sin[x]^2, {x, 0, Pi},
FrameLabel -> {"", ""},
Epilog -> {
Inset["y", ImageScaled[{0.01, 0.55}], {0, 0}, Automatic, {0, 1}]
},
BaseStyle -> {FontSize -> 16, FontWeight -> Bold,
FontFamily -> "Calibri"},
ImagePadding -> {{pad, pad/4}, {pad, pad/4}},
Frame -> {True, True, True, True},
PlotRangeClipping -> False
]
, ImageSize -> 640]
,
Show[
Plot[ -Sin[x]^2/1000, {x, 0, Pi},
FrameLabel -> {"x", ""},
PlotRangeClipping -> False,
Epilog -> {
Inset["y", ImageScaled[{0.01, 0.55}], {0, 0}, Automatic, {0, 1}]
},
BaseStyle -> {FontSize -> 16, FontWeight -> Bold,
FontFamily -> "Calibri"},
ImagePadding -> {{pad, pad/4}, {pad, pad/4}},
Frame -> {True, True, True, True}
]
, ImageSize -> 640]
}
]

产生以下结果:
Solution

我看到发布的其他解决方案 - 谢谢你们,但我更喜欢我的解决方案,尽管它与@Mr.Wizard 解决方案非常相似。抱歉刚刚发布了解决方案,但是当我找到它时,我无法发布,因为该网站要求我等待 8 小时才能回答我自己的问题。

关于wolfram-mathematica - Wolfram Mathematica : y-axis frame labels are not aligned,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9207569/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com