求助:数轴图怎么设置数轴范围?
mathematica吧
全部回复
仅看楼主
level 5
qiyaya🌵 楼主
代码如下:
NumberLinePlot[{Around[17.9, 1.9], Around[18.8, {3.0, 2.5}],
Around[20, 2], Around[17.5, 1.5]},
PlotLegends -> {"a", "b", "c", "d"}]
两个问题,感谢:
1 我这样画出来数轴老是从0开始,我想让它的范围变成14-22,查过帮助试了Plotrange没成功,如图1。
2 怎么改变上面数据线的格式?我想让它像误差棒一样边界伸出来一截,如图2里的竖着的(图来自网络)。因为我希望误差棒是横着的,所以没法一般地处理。
2023年10月24日 02点10分 1
level 5
qiyaya🌵 楼主
代码更新一下,用了PlotRange和Ticks之后:
NumberLinePlot[{Around[17.9, 1.9], Around[18.8, {3.0, 2.5}],
Around[20, 2], Around[17.5, 1.5]}, Ticks -> {{14, 16, 18, 20, 22}},
PlotRange -> {14, 22}, PlotLegends -> {"a", "b", "c", "d"}]
2023年10月24日 02点10分 2
吧务
level 13
可以用 Show 改图形的 PlotRange
ListPlot 支持 {x,y} 的形式
2023年10月24日 11点10分 4
感谢回答!但是我试过ListPlot,ListPlot好像不能只有一个轴吧 虽然可以把某个轴隐藏。但是我想要的效果是主楼图1,也就是y轴没有值只有不同的选项,这样怎么办到呢?
2023年10月25日 02点10分
接上:Show[ListPlot[{Around[17.9, 1.9], Around[18.8, {3.0, 2.5}], Around[20, 2], Around[17.5, 1.5]}], Axes -> {False, True}] 这是我用ListPlot的代码
2023年10月25日 02点10分
@qiyaya🌵 将你一维数据转一下格式 ListPlot[i = 1; {{#, i++}} & /@ data]
2023年10月25日 03点10分
@qiyaya🌵 另外 NumberLinePlot 支持 IntervalMarkers -> "Fences"
2023年10月25日 03点10分
1