pngcairo不显示轴Gnuplot

时间:2013-04-26 12:05:21

标签: plot gnuplot cairo

我刚刚通过brew在我的mac上安装了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

This plot and data comes from gnuplotting.org

2 个答案:

答案 0 :(得分:2)

如何解决问题:

在您的终端中输入

brew rm cairo pango gnuplot
brew edit pango

将网址和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

答案 1 :(得分:0)

尝试这是否适合您:

set xzeroaxis
set yzeroaxis
set xtics axis
set ytics axis