Total Pageviews

Blog Archive

Teaching (237) Mathematica (155) 3Q (48) Excel (45) SPSS (32) Cat (24) LaTeX (23) Mac (22) 君達呀 (15) Kaohsiung (14) 論文測試 (13) Mathematica教學講義 (3)

 

Followers

Mathematica 教學 ContourPlot problem about color setting

Chung-Yuan Dye 於 Thursday, September 15, 2011 11:25 PM 發表
今天發現Mathematica的ContourPlot在處理一個比較複雜函數時若要求輸出ContourLabels時色彩的設定會出現問題

cp2 = ContourPlot[Evaluate@TP[t1, t2temp[t1, \[Xi]], \[Xi]], {t1, 0, 0.5}, {\[Xi], 0,
w}, Contours -> Range[17500, 18900, 200]]
cp3 = ContourPlot[Evaluate@TP[t1, t2temp[t1, \[Xi]], \[Xi]], {t1, 0, 0.5}, {\[Xi], 0,
w}, Contours -> Range[17500, 18900, 200], ContourLabels -> True]


比較以上兩個圖形會發現下面的圖形色彩的出現錯誤

(* 找出正常設定值 *)
zz = Cases[cp2[[1]], RGBColor[a_, b_, c_] :> {a, b, c}, Infinity];
z[i_] := zz[[i]]

(* 將正常設定值取代錯誤設定值 *)
(i = 1; Graphics[cp3[[1]] /. RGBColor[_, _, _] :> RGBColor @@ z[i++], cp3[[2]]])


Tags:

讀者回應 ( 0 意見 )

Post a Comment

Please leave your name and tell me what you thought about this site. Comments, suggestions and views are welcomed.

如果這篇文章對你有幫助,那請留個訊息給我~