Mathematica で出版用のグラフィックスを作成したいのですが.
以下に,出版に使用するグラフィックスの作成方法の簡単な例を示します.実験データの分析の最終結果を示す下のグラフィックスは,最終的にはほんのわずかのコマンドで作成することができます.ここでは,グラフィックス内の各要素の作成方法を1つずつ説明していきます.
![[Graphics:Images/Labels2_gr_1.gif]](Images/Labels2_gr_1.gif)
元のデータセットをインポートしてプロットする
まず,ListPlotコマンドを使って,元のデータセットをインポートしてプロットします.ImportとListPlotの詳細はヘルプブラウザでご覧ください.
![[Graphics:Images/Labels2_gr_2.gif]](Images/Labels2_gr_2.gif)
![[Graphics:Images/Labels2_gr_3.gif]](Images/Labels2_gr_3.gif)
![[Graphics:Images/Labels2_gr_4.gif]](Images/Labels2_gr_4.gif)
![[Graphics:Images/Labels2_gr_5.gif]](Images/Labels2_gr_5.gif)
![[Graphics:Images/Labels2_gr_6.gif]](Images/Labels2_gr_6.gif)
フレームとフレームラベルを加える
オプションFrame->Trueを使ってプロットにフレームを加えます.これは,数あるListPlotのオプションの1つです.オプションについての追加情報は,ヘルプブラウザでご覧になるか,Options[ListPlot]を評価してご覧ください.ListPlotには固有のオプションの他に,Graphicsと同じオプションを取ることもできます.
![[Graphics:Images/Labels2_gr_7.gif]](Images/Labels2_gr_7.gif)
![[Graphics:Images/Labels2_gr_8.gif]](Images/Labels2_gr_8.gif)
![[Graphics:Images/Labels2_gr_9.gif]](Images/Labels2_gr_9.gif)
![[Graphics:Images/Labels2_gr_10.gif]](Images/Labels2_gr_10.gif)
次に,FrameLabel->{Temperature, Mortality}を使って,x 軸とy 軸にフレームラベルを付けます.FrameLabelについての詳細は,ヘルプブラウザでご覧ください.
![[Graphics:Images/Labels2_gr_11.gif]](Images/Labels2_gr_11.gif)
![[Graphics:Images/Labels2_gr_12.gif]](Images/Labels2_gr_12.gif)
プロットラベルを加える
PlotLabelを使うと,プロットに簡単にタイトルを加えることができます.
![[Graphics:Images/Labels2_gr_13.gif]](Images/Labels2_gr_13.gif)
![[Graphics:Images/Labels2_gr_14.gif]](Images/Labels2_gr_14.gif)
Courier以外のフォントが使用したい場合は,少し手間がかかります.最も簡単な方法の1つに,DefaultFontを使ってこのグラフィックス内のすべてのフォントを変更するというものがあります.
![[Graphics:Images/Labels2_gr_15.gif]](Images/Labels2_gr_15.gif)
![[Graphics:Images/Labels2_gr_16.gif]](Images/Labels2_gr_16.gif)
これとは別の方法としては,TextStyleを使ったものがあります.
![[Graphics:Images/Labels2_gr_17.gif]](Images/Labels2_gr_17.gif)
![[Graphics:Images/Labels2_gr_18.gif]](Images/Labels2_gr_18.gif)
実際,TextStyleはDefaultFontよりもかなり柔軟です.例えば,TextStyleではFontColor,
FontWeight,FontSlantを設定することもできます.以下の例では,FontColorも加えます.Graphics`Colors`をロードすると,RGBの3原色の代りに色の名前を使うことができるようになります.
![[Graphics:Images/Labels2_gr_19.gif]](Images/Labels2_gr_19.gif)
![[Graphics:Images/Labels2_gr_20.gif]](Images/Labels2_gr_20.gif)
![[Graphics:Images/Labels2_gr_21.gif]](Images/Labels2_gr_21.gif)
グラフにフィットを加え,色を変更する
まず,データをそのままの形でフィットします.次に異常値を削除して再びデータをフィットします.
![[Graphics:Images/Labels2_gr_22.gif]](Images/Labels2_gr_22.gif)
![[Graphics:Images/Labels2_gr_23.gif]](Images/Labels2_gr_23.gif)
![[Graphics:Images/Labels2_gr_24.gif]](Images/Labels2_gr_24.gif)
![[Graphics:Images/Labels2_gr_25.gif]](Images/Labels2_gr_25.gif)
![[Graphics:Images/Labels2_gr_26.gif]](Images/Labels2_gr_26.gif)
![[Graphics:Images/Labels2_gr_27.gif]](Images/Labels2_gr_27.gif)
上記のフィットの出力は式になっています.従って,フィットをプロットするためにはPlotを使わなければなりません.PlotStyle->RGBColor[]で線の色をRGBの値に変更します.
![[Graphics:Images/Labels2_gr_28.gif]](Images/Labels2_gr_28.gif)
![[Graphics:Images/Labels2_gr_29.gif]](Images/Labels2_gr_29.gif)
![[Graphics:Images/Labels2_gr_30.gif]](Images/Labels2_gr_30.gif)
![[Graphics:Images/Labels2_gr_31.gif]](Images/Labels2_gr_31.gif)
Showを使うと,上の2つのフィットが元のデータプロットとともに表示されます.
![[Graphics:Images/Labels2_gr_32.gif]](Images/Labels2_gr_32.gif)
![[Graphics:Images/Labels2_gr_33.gif]](Images/Labels2_gr_33.gif)
凡例を加える
Mathematica 関数のLegendは,Graphics`パッケージの一部です.これを使用するためには,まず,パッケージをロードします.
<< Graphics`Legend`
LegendPositionとLegendSizeの2つのオプションを設定します.LegendPositionは{0, 0}(グラフィックスの左下隅)と{1, 1}(グラフィックスの右上隅)の間の値を取ります.LegendSizeのパラメータは,グラフィックスの全サイズの一部です.
![[Graphics:Images/Labels2_gr_36.gif]](Images/Labels2_gr_36.gif)
![[Graphics:Images/Labels2_gr_37.jpg]](Images/Labels2_gr_37.jpg)
|