公告:1)网站程序升级:Q2A升级到1.8.6,Wordpress升级到5.7.2
2)修复了头像加载慢与提交问题反应慢等问题
2021-06-16

欢迎来到 Mathematica 问答社区

提问时请贴上文本代码

语法高亮:在编辑器中点击

被禁止的话题:广告破解

请阅读:《提问的智慧》

备用域名:mma.ooo

支持LaTex数学公式
行内公式标识符:\$ 或“$\backslash ($”+“$\backslash )$”,
行间公式标识符:\$\$ 或 “$\backslash [$”+“$\backslash ]$”

社区建议QQ群:365716997

分类

0 投票
42 浏览
ClearAll["`*"]
SetDirectory[NotebookDirectory[]];
m1 = ParametricPlot[{v Cos[u], v Sin[u]}, {u, 0, 2 Pi}, {v, 1.5, 1.7},
    Mesh -> None, Frame -> False, 
   ColorFunction -> "LightTemperatureMap", BoundaryStyle -> None, 
   Axes -> False, Background -> White, 
   PlotLegends -> 
    Placed[BarLegend[Automatic, LegendMarkerSize -> {20, 200}, 
      LegendLabel -> "\[CapitalDelta](\[Theta])", 
      LabelStyle -> 
       Directive[Black, FontSize -> 24, 
        FontFamily -> "Times New Roman"]], {After, Center}]];
axes = Graphics[{Arrow[{{{0, 0}, {0, 2}}, {{0, 0}, {2, 0}}}], {Dashed,
      Arrow[{{0, 0}, {Sqrt[2], Sqrt[2]}}]}, 
    Text[Style["\[Theta]", FontFamily -> "Times New Roman", 24], {0.8,
       0.4}], Text[
     Style["\!\(\*SubscriptBox[\(k\), \(x\)]\)", 
      FontFamily -> "Times New Roman", 24], {2.3, 0}], 
    Text[Style["\!\(\*SubscriptBox[\(k\), \(y\)]\)", 
      FontFamily -> "Times New Roman", 24], {0, 2.3}], 
    Text[Style["\!\(\*FractionBox[\(\[Pi]\), \(2\)]\)", 
      FontFamily -> "Times New Roman", 24], {-0.3, 1.4}], 
    Text[Style["-\!\(\*FractionBox[\(\[Pi]\), \(2\)]\)", 
      FontFamily -> "Times New Roman", 24], {-0., -1.2}]}];
ang = ParametricPlot[0.6 {Sin[x], Cos[x]}, {x, Pi/4, Pi/2}, 
   PlotStyle -> Directive[Dashed, Thickness[0.008], Red]];
Show[m1, axes, ang, PlotRange -> All]

写了一段代码,结果如下

实际上这只是个示意图,但是BarLegend上的数字并不代表真实值的大小,想把它去了,只留下颜色深浅代表正负值即可。

或者可以将这些数字标签值根据颜色深浅不同修改成>0和< 0,谢谢解答。

用户: 落雨流觞 (1.0k 分)

1个回答

0 投票
 
已采纳

我并没有找到可以通过直接修改 BarLegend 的来实现去掉刻度方法。下面是使用 Epilog 和 Inset 插入 Graphics 来近似实现的。

如果你使用的是 12.3版本,可以再加一个 AxisObject 来自定义刻度尺。

另外,我猜啊,圆环的着色可能并不是你想要的着色(目前这个只是对 x 轴着色,相当于 ColorFunction -> Function[{x, y, u, v}, ColorData["LightTemperatureMap"][x]],其它的3个参数yuv都没有用到,其中xy是位置参数,uv是计算xy的输入参数 

ClearAll["`*"]

barLegend = {
   Inset[Style["\[CapitalDelta](\[Theta])", Black, FontSize -> 24, 
     FontFamily -> "Times New Roman"], {2.6, 1.8}],
   Rotate[
    Inset[ColorData["LightTemperatureMap", 
       "Image"] /. {(Rule[AspectRatio, Rational[1, 8]]) -> (Rule[
          AspectRatio, Rational[1, 18]])}, {2.6, 0}, Automatic, 3], 
    Pi/2]
   };

m1 = ParametricPlot[{v Cos[u], v Sin[u]}, {u, 0, 2 Pi}, {v, 1.5, 1.7},
    Mesh -> None, Frame -> False, 
   ColorFunction -> "LightTemperatureMap", BoundaryStyle -> None, 
   Axes -> False, Background -> White, Epilog -> barLegend];
axes = Graphics[{Arrow[{{{0, 0}, {0, 2}}, {{0, 0}, {2, 0}}}], {Dashed,
      Arrow[{{0, 0}, {Sqrt[2], Sqrt[2]}}]}, 
    Text[Style["\[Theta]", FontFamily -> "Times New Roman", 24], {0.8,
       0.4}], Text[
     Style["\!\(\*SubscriptBox[\(k\), \(x\)]\)", 
      FontFamily -> "Times New Roman", 24], {2.3, 0}], 
    Text[Style["\!\(\*SubscriptBox[\(k\), \(y\)]\)", 
      FontFamily -> "Times New Roman", 24], {0, 2.3}], 
    Text[Style["\!\(\*FractionBox[\(\[Pi]\), \(2\)]\)", 
      FontFamily -> "Times New Roman", 24], {-0.3, 1.4}], 
    Text[Style["-\!\(\*FractionBox[\(\[Pi]\), \(2\)]\)", 
      FontFamily -> "Times New Roman", 24], {-0., -1.2}]}];
ang = ParametricPlot[0.6 {Sin[x], Cos[x]}, {x, Pi/4, Pi/2}, 
   PlotStyle -> Directive[Dashed, Thickness[0.008], Red]];
Show[m1, axes, ang, PlotRange -> {{-2, 5}, Automatic}]

 

用户: 野鹤 (5.0k 分)
采纳于 用户:落雨流觞
谢谢了,着色是我想要的,不过你提供的方案也给了我很多帮助,谢谢
...