【问题标题】:pngcairo does not display axis Gnuplotpngcairo 不显示轴 Gnuplot
【发布时间】:2013-04-27 02:55:16
【问题描述】:

我刚刚在我的 Mac 上通过 brew 安装了 gnuplot 和 pngcairo,当我绘制数据或函数时,轴没有显示(尽管它显示了图表)。

如果我将终端更改为 png 或 svg 或其他任何东西,它会完美运行,但是一旦我将终端再次设置为 pngcairo,它就会专注于图形。

有解决这个问题的想法吗? (此图和数据来自gnuplotting.org)

#!/usr/bin/gnuplot
#
# Creates a version of a plot, which looks nice for inclusion on web pages
#
# AUTHOR: Hagen Wierstorf


reset

# png
#set terminal pngcairo 
#set output 'nice_web_plot.png' 

set xtics rotate by 90 offset 0,0 right
# define axis
# remove border on top and right and set color to gray
set style line 11 lc rgb '#808080' lt 1
set border 3 back ls 11
set tics nomirror
# define grid
set style line 12 lc rgb '#808080' lt 0 lw 1
set grid back ls 12

# color definitions
set style line 1 lc rgb '#8b1a0e' pt 1 ps 1 lt 1 lw 2 # --- red
set style line 2 lc rgb '#5e9c36' pt 6 ps 1 lt 1 lw 2 # --- green

set key bottom right

set xlabel 'x axis label'
set ylabel 'y axis label'
set xrange [0:1]
set yrange [0:1]

plot 'data.dat' u 1:2 t 'Example line' w lp ls 1, \
 ''                  u 1:3 t 'Another example' w lp ls 2

【问题讨论】:

  • 你能发布你用来制作情节的代码,以及 gnuplot 版本吗?
  • 我编辑了帖子,我使用 OS X 10.8.3 和 gnuplot 4.6.2 获取信息。

标签: plot gnuplot cairo


【解决方案1】:

如何解决问题:

在你的终端输入这个

brew rm cairo pango gnuplot
brew edit pango

将 url 和 sha256 更改为

url 'http://ftp.gnome.org/pub/GNOME/sources/pango/1.29/pango-1.29.5.tar.xz'
sha256 '578c38de8450baa61d651e96049d2710f242bda3c47afc2d84773cbafeed775a'

然后重新安装gnuplot

brew install gnuplot --cairo --wx --use-clang

它现在应该可以工作了(这个解决方案在这里找到:https://github.com/mxcl/homebrew/issues/11901

【讨论】:

    【解决方案2】:

    试试这是否适合你:

    set xzeroaxis
    set yzeroaxis
    set xtics axis
    set ytics axis
    

    【讨论】:

    • 感谢您的回答,但不,我也没有尝试过。
    • @Anoracx 另一个想法:也许你的抽动根本不显示在轴上,因为抽动的默认距离是 1,而你的情节只从 0 到 1。试试set xtics 0.2
    猜你喜欢
    • 1970-01-01
    • 2012-05-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-06
    • 1970-01-01
    相关资源
    最近更新 更多