gnuplot - 将 gnuplot 轴标签旋转到 45 度,无需 rtics

标签 gnuplot

我在 Gnuplot 中有一个极坐标图,由

给出
set polar
set angles degrees
unset xtics
unset ytics
unset raxis
set ttics 0,30
set grid polar linestyle 1 dashtype 2 linecolor rgb 'grey'
set samples 200, 200
unset border

set xrange [-0.51:0.51]
set yrange [-0.51:0.51]
set size square
unset key

plot sin(2*t)*cos(2*t)

输出如下:

Polar plot

但是,

  1. 我希望 rlabel(0、0.1、0.2 等)呈 45 度角,而不是放置在 x 轴上,并且
  2. 不应该有任何问题

任何帮助将不胜感激。

最佳答案

为了删除rtics,请设置rtics比例0

您可以设置极坐标图的起始角度(请查看 help theta),但是只能设置为 {right|top|left|bottom} 而不是 45° ,但这仍然对你没有帮助。 因此,您可能必须“手动”设置标签。也许有一种我不知道的自动方式。检查以下示例。

代码:

### set rtics on 45° "axis"
reset session

set polar
set angles degrees
unset xtics
unset ytics
unset raxis
set ttics 0,30
set grid polar linestyle 1 dashtype 2 linecolor rgb 'grey'
set samples 200, 200
unset border

set xrange [-0.51:0.51]
set yrange [-0.51:0.51]
set size square
unset key
set rtics scale 0
set format r ""

myRTics = "0.1 0.2 0.3 0.4 0.5"
do for [i=1:words(myRTics)] {
    r = word(myRTics,i)
    set label i sprintf("%s",r) at r*cos(45),r*sin(45) center
}
plot sin(2*t)*cos(2*t)
### end of code

结果:

enter image description here

关于gnuplot - 将 gnuplot 轴标签旋转到 45 度,无需 rtics,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69331992/

相关文章:

gnuplot - gnuplot 中的文件名完成未完成边界

gnuplot:更改 x 轴的值

Gnuplot x 轴分辨率

plot - 导出时 Gnuplot 中的重叠线

gnuplot - 如何使用 gnuplot 绘制简单的二维矢量箭头?

gnuplot - 如何根据其数据更改时间格式

c++ - 写入文本文件并使用 c++ 和 gnuplot 绘图

c++ - 找不到用 C++ 编写的 gnuplot.exe 路径

python - 如何在 Python 中绘制元组列表?

linux - Gnuplot 不加载图表