2011-07-21 23 views
10

私は、円形の座標系(R、シータ)にはgnuplot(つまりを使用して、半径方向(極性)のプロットをしたいgnuプロットを使って放射状(極座標)のプロットを得るには?

ここで私は値が使用されています。そのようなプロットを取得する方法

Theta Max-strain 
0  3400 
60 5300 
120 4700 
180 3800 
240 4100 
300 3100 
360 3400 

を?GNU-プロットを使用して

+3

0度で重複しているので、プロットの360度を取り除きたい場合があります。 – Woltan

答えて

25

私はあなたの質問のプロットを再作成しようとしましたが、これは私が思い付いたものです:あなたが見ることができるように

unset border 
set polar 
set angles degrees #set gnuplot on degrees instead of radians 

set style line 10 lt 1 lc 0 lw 0.3 #redefine a new line style for the grid 

set grid polar 60 #set the grid to be displayed every 60 degrees 
set grid ls 10 

set xrange [-6000:6000] #make gnuplot to go until 6000 
set yrange [-6000:6000] 

set xtics axis #disply the xtics on the axis instead of on the border 
set ytics axis 

set xtics scale 0 #"remove" the tics so that only the y tics are displayed 
set xtics ("" 1000, "" 2000, "" 3000, "" 4000, "" 5000, "" 6000) #set the xtics only go from 0 to 6000 with increment of1000 but do not display anything. This has to be done otherwise the grid will not be displayed correctly. 
set ytics 0, 1000, 6000 #make the ytics go from the center (0) to 6000 with incrment of 1000 

set size square 

set key lmargin 

set_label(x, text) = sprintf("set label '%s' at (6500*cos(%f)), (6500*sin(%f))  center", text, x, x) #this places a label on the outside 

#here all labels are created 
eval set_label(0, "0") 
eval set_label(60, "60") 
eval set_label(120, "120") 
eval set_label(180, "180") 
eval set_label(240, "240") 
eval set_label(300, "300") 


set style line 11 lt 1 lw 2 pt 2 ps 2 #set the line style for the plot 

#and finally the plot 
plot "-" u 1:2 t "Max strain" w lp ls 11 
0 3400 
60 5300 
120 4700 
180 3800 
240 4100 
300 3100 
360 3400 
e 

Plot of the script above

主な違いは、角度0が上にはなく、右にあることです(これは数学的に正しい)。ただし、これを変更するには、プロットとset_label関数で使用する減速度を変更します。

スクリプトでわかるように、すべてが本当に鮮明で光沢があります。誰かが改善を見つけた場合は、私に知らせてください!

「アドバイス」の最後の1ビット:gnuplotを使って、あるツールからプロットを再現しようとするのは必ずしも妥当ではありません。多くの場合、gnuplotの強みは、データを最も簡単に再現しやすいようにプロットすることです。おそらく上記のスクリプトからいくつかの行を蹴ることができ、まだそれに満足しているかもしれません。

+0

ありがとうございました。とても役に立ちました。上記のようにset_labelを使ってみましたが、エラーが発生しました。ラベルを外に出しても問題ありません。また、負の値が-3400、-5300などと表示された場合、y軸の6000から0の代わりに上記のプロットでは、0から-6000の範囲内になるはずです。プロットに似てMS Excelで取得します。どのようにそのようなプロットを取得するには? – Dolly

+0

@Dolly 'set_label'マクロは私のマシンで動作しています。エラーメッセージとは何ですか?負の値について:極座標プロットでは、値が多かれ少なかれ半径であり、半径が負でないことができるので、負の値を持つことはできません。負の値をとっている場合は、極座標プロットを使用しないでください。あるいは、 'exp'と' log'を使ってマッピングするべきでしょうか? – Woltan

+1

私はset_labelプロットを使用して作成されていません。 set_labelを使用しないと、plotが作成されます。古いgnu-plotバージョンでは使用できませんか?新しいバージョンはどこでダウンロードできますか? – Dolly

5

をここでは、手動http://t16web.lanl.gov/Kawano/gnuplot/polar-e.html

set polar 
set angles degrees 

で、円を得るために:

set grid polar 

ここではデモです:http://gnuplot.sourceforge.net/demo/polar.html

+2

ありがとうございました。私はすでにset grid polarを使ってみました。しかし、私はそれに角度を表示することはできませんでした。私はxとyを指定しなければなりません。得られたプロットは私が望むものと一致しませんでした。私は今、私の質問を再構成しました。私は今回ははっきりしているといいですね。 – Dolly

+0

'plot data ... with lines'を実行しようとしています。 – osgx

+0

'set grid polar 30'は、それぞれ30度の線でグリッドを追加します。 – osgx

関連する問題