【问题标题】:why isn't GR showing axis-labels in Julia为什么 GR 不在 Julia 中显示轴标签
【发布时间】:2021-08-29 04:19:27
【问题描述】:

所以,我有一个如下所示的数组:

7-element Vector{Pair{Any, Any}}:
 "Python hand-written" => 3104.096806
    "Python- Built-in" => 2488.479628
  "Julia hand-written" => 14.478426
                   "C" => 13.675734
        "C ffast-math" => 7.390966
      "Julia built-in" => 5.510281
        "Python numpy" => 4.949694

我正在尝试在水平条形图中绘制此数据,但由于某种原因我收到错误:

GKS: Rectangle definition is invalid routine SET_VIEWPORT

这是我的一段代码:

x = map(x->x[1], l_vec)
y = map(x->x[2], l_vec)

x_ticks = [0, 1, 2, 3,4, 5,  1000, 1500, 2000, 2500]

bar(x ,y , color="dark blue",
    xaxis = ("time (ms)",:log10, 45),
    yaxis = ("Languages"),
    orientation= :horizontal,label = "" ,fillrange=1e-2, xticks =(x_ticks, x_ticks))

我不确定我是否理解这个错误...

【问题讨论】:

标签: plot julia bar-chart


【解决方案1】:

问题是您要求在对数刻度上的x=0 放置标签。

顺便说一句,我推荐against plotting bars on a logscale

如果你真的想要对数刻度条,删除 x_ticks 中的零,你会得到

【讨论】:

  • 好的,这是我在这里问过的最愚蠢的事情。不过还是谢谢
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-05-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-10
  • 2017-08-12
相关资源
最近更新 更多