- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
您如何在 mathematica 中将文本放置在绘图之外?一个快速的谷歌搜索将
带你到
http://reference.wolfram.com/mathematica/howto/AddTextOutsideThePlotArea.html
这还不够,因为您想用代码实现这一点。在 mathematica 中放置文本的简单示例如下:
Show[
Plot[x^3, {x, -1, 1},
Frame -> True,
ImageSize -> Medium,
FrameLabel -> {"x", "y"},
PlotRange -> {{-1, 1}, {-1, 1}}
],
Graphics[
Text[Style["A", Bold, 14, Red], {.5, .5}]]
]
这会将字母 A 放置在相对于绘图的点 (.5, .5) 处。有没有办法根据图像的大小放置文本?据我所知,一切都是在情节坐标中完成的。我的临时解决方案是设置选项
PlotRangeClipping
至
False
并通过给出正确的坐标来设置文本。
Show[
Plot[
x^3, {x, -1, 1},
Frame -> True,
ImageSize -> Medium,
FrameLabel -> {"x", "y"},
PlotRange -> {{-1, 1}, {-1, 1}}
],
Graphics[
Text[
Style["A", Bold, 14, Red],
{-1.2, 1}
]
],
PlotRangeClipping -> False
]
Text
A外剧情。
Framed[
Show[
Graphics[
{Orange, Disk[{0, 0}, 3.5]},
Frame -> True,
PlotRange -> {{-3, 3}, {-3, 3}},
PlotRangeClipping -> True,
FrameLabel -> {"x", "y"}
],
Graphics[
Text[
Style["A", Bold, 14],
ImageScaled[{.1, .95}]
]
]
]
]
plotRangeClipping
.
mask2D = Graphics[{Gray,
Polygon[{
ImageScaled[{-0.5, -0.5}],
ImageScaled[{-0.5, 1.5}],
ImageScaled[{1.5, 1.5}],
ImageScaled[{1.5, -0.5}],
ImageScaled[{-0.5, -0.5}],
Scaled[{0, 0}],
Scaled[{1, 0}],
Scaled[{1, 1}],
Scaled[{0, 1}],
Scaled[{0, 0}],
ImageScaled[{-0.5, -0.5}]
}]
}];
在某些情况下使用
ImageScaled
的
{1,1}
不足以剪辑主图像。为此原因
1.5
提供了更多的报道和
-0.5
.现在我们可以绘制带有标签的图像,如下所示:
Framed@Show[
Graphics[
{
Orange,
Disk[{0, 0}, 3.5]
},
Frame -> True,
PlotRange -> {{-3, 3}, {-3, 3}},
FrameLabel -> {"x", "y"}
],
mask2D,
Graphics[
Text[
Style["A", Bold, 14],
ImageScaled[{0, 1}],
{-1, 1}
]
],
Background -> Red
]
这是所需的图像:
Background
轻松修改。属性和掩码只需更改
Gray
例如,您喜欢的任何颜色(白色)。
最佳答案
Plot[x^3, {x, -1, 1},
Frame -> True,
ImageSize -> Medium,
FrameLabel -> {"x", "y"},
PlotRange -> {{-1, 1}, {-1, 1}}],
PlotRangeClipping -> False,
Epilog ->
Text[Style["A", Bold, 14, Red], ImageScaled@{.05, .98}]
Show
连接图形选项,因此
PlotRangeClipping
不能有多个值在 Show[ ] 命令中。
InsertLabels[g_Graphics, legend__] :=
Show[Rasterize[g],
Graphics[{legend},
Cases[AbsoluteOptions[g], Except[PlotRangeClipping -> True]]]];
g = Graphics[
{Gray, Disk[{0, 0}, 3.5]},
Frame -> True,
PlotRange -> {{-3, 3}, {-3, 3}},
FrameLabel -> {"x", "y"},
PlotRangeClipping -> True];
Framed@InsertLabels[g,
Text[Style["B", Red, Bold, 18], ImageScaled[{0.95, .05}]],
Text[Style["A", Red, Bold, 18], ImageScaled[{0.05, .95}]]]
关于wolfram-mathematica - 数学 : Labels and absolute positioning,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6274440/
我刚刚创建了一个非常大的神经网络,尽管是在非常强大的硬件上,想象一下我的震惊和失望,当我意识到 NeuralNetworks 包中的 NeuralFit[] 似乎只使用一个核心,甚至没有发挥到最大能力
我想知道是否有办法在 Mathematica 中处理大文件? 目前我有一个大约 500Mb 的文件,其中包含表数据。 Import["data.txt","Table"]; 什么是替代方式? 最佳答案
Mathematica 是否支持为数学符号安装非 Wolfram 字体? 其他数学符号字体的例子包括最近发布的 STIX 字体、微软的 Cambria 字体、Latex 下使用的 Math Tim
这是一个简单的 WolframCloud computation : 当 0 Infinity]会显示正确答案,即Boole[0Infinity] 输出应该是Boole[0 Infinity] 顺便说
在 MATHEMATICA 中是否有一种快速简便的方法来截断十进制数,比如超过 4 位? 对于 N[1/6, 4],它四舍五入为 =1.6667。 我要你切到 1.6666。 谢谢! 最佳答案 f[x
我有一个等式(因为是 VBA 代码所以使用了括号) Y=(P/(12E((bt^3)/12))*A 我知道每个变量,但不知道“b”。有什么方法可以让 Wolfram Alpha“重新定义”(而不是求解
我找到了 Wolfram Workbench Mathematica 开发的良好环境。 然而,当我在 Mathematica 中编程时,我需要经常浏览帮助系统。 Workbench 提供了一个工具提示
问题 我正在查看 Wolfram's Mathematica 生成随机数的方法,发现它使用 Cellular Automata Rule 30 .其基本解释如下: 一个基本元胞自动机的演化可以完全用一
我需要对可变数量的集合的笛卡尔积求和。假设 f[...] 是一个多元函数,定义 p[A__set] := Module[{Alist, args, iterators,it}, Alist =
当鼠标光标在 Wolfram|Alpha 中的 2D 绘图上时,会出现一对灰线,帮助您读取 x 和 y 轴的坐标 . For example ,我将鼠标悬停在以下 Airy 函数图中的转折点之一上。
我正在 Mathematica 中生成一个双面板图形。底部面板在 y 轴上具有负值,这会导致该轴上的标签(使用 FrameLabel 生成)比顶部面板上的标签向左对齐,后者具有正值。我无法将面板连接到
我有几个在 Mathematica 中生成的表达式,我想将它们导出到外部 C 程序的源代码中。 “CForm”几乎可以满足我的要求,只是求幂表示为对 Power() 的调用。 .我的表达式只涉及小幂,
Wolfram 系统建模器有一个名为 "equation browser" 的函数, youtube 视频 here (at 20:58) 介绍了“方程浏览器”,我想知道Dymola是否有相同的功能,
我有适用于 Mac 的 Mathematica 8.0 和 Wolfram Workbench 2.0。我想使用 MUnit 对我正在创建的包进行单元测试,但我发现缺少有关 MUnit 的文档令人沮丧
我希望能够通过具有大量内存的计算机的命令行来处理 Wolfram 语言。这似乎很容易通过 GCP 实现。我会创建一个大实例,根据需要使用它,然后删除该实例。我很好奇,我将如何在 GCP 上安装和设置
给定字符串中符号的名称,如何多次为其赋值?例如,假设我想定义一个名称为 varname 的值的符号,并且我想为它分配一个值: varname = "foo" Symbol[varname]=5 这是行
我的笔记本中有类似以下内容。 test1[g_] := (g == 5); test2[g_] := (g == 6); tests={"test1", "test2"} ToExpression[#
我正在尝试学习一些 Julia,在阅读了几个小时的手册后,我编写了以下代码: ie = 200; ez = zeros(ie + 1); hy = zeros(ie); fdtd1d (steps)=
不确定我正在尝试做的事情是否有意义。我正在用mathematica 对一些代码进行原型(prototype)设计,有一天我希望用C++ 编写。我只能以 double 计算的环境(因为我使用的是 MS
我经常希望看到不在 FullForm 中的 Mathematica 图形对象的内部表示。但更具可读性 InputForm能够通过双击选择部分代码,并轻松将此代码复制到新输入 Cell .但默认Inpu
我是一名优秀的程序员,十分优秀!