How Do I Create Graphics for Publication in Mathematica?
This basic example shows how to create a graphic to be used for publication.
In the end, the graphic below, showing the final results of the analysis of
experimental data, will be created with just a few commands. In this particular
example, we will go through the steps to explain how to create each element
in the graphic.
![[Graphics:Images/Labels2_gr_1.gif]](Images/Labels2_gr_1.gif)
Importing and Plotting the Original Data Set
First, import and plot the original data set using the command
ListPlot. More information on both
Import
and ListPlot
are available in the Help Browser.
![[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)
Adding a Frame and Frame Labels
Add a frame to the plot of our data using the option
Frame->True. This is one of many options to
ListPlot.
For more information on options, look in the Help Browser or evaluate Options[ListPlot]. In addition to its own specific options,
ListPlot also accepts the same options as
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)
Using FrameLabel->{Temperature, Mortality}, now
add frame labels to label the x and y axes. More information on
FrameLabel
is available in the Help Browser.
![[Graphics:Images/Labels2_gr_11.gif]](Images/Labels2_gr_11.gif)
![[Graphics:Images/Labels2_gr_12.gif]](Images/Labels2_gr_12.gif)
Adding Plot Labels
PlotLabel provides
a convenient way to add titles to plots.
![[Graphics:Images/Labels2_gr_13.gif]](Images/Labels2_gr_13.gif)
![[Graphics:Images/Labels2_gr_14.gif]](Images/Labels2_gr_14.gif)
Using a font other than Courier requires a bit more work. One of the easiest methods
is to use DefaultFont to
change all the fonts in the graphic.
![[Graphics:Images/Labels2_gr_15.gif]](Images/Labels2_gr_15.gif)
![[Graphics:Images/Labels2_gr_16.gif]](Images/Labels2_gr_16.gif)
A less radical method is using TextStyle.
![[Graphics:Images/Labels2_gr_17.gif]](Images/Labels2_gr_17.gif)
![[Graphics:Images/Labels2_gr_18.gif]](Images/Labels2_gr_18.gif)
TextStyle
actually gives much more flexibility than DefaultFont.
For example, it can also be used to set FontColor,
FontWeight,
and FontSlant. Below, FontColor
is also added. Loading
Graphics`Colors` allows you to use color names rather
than RGB triplets.
![[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)
Adding Fits to Graphs and Changing Colors
First, fit the data as is. Then, remove an outlier and refit the data.
![[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)
Notice that the output of the fits above are equations. Therefore,
Plot has to be used to plot the fit.
PlotStyle->RGBColor[] changes the line color to the RGB value.
![[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)
The two fits can be shown with the original data plot by using
Show.
![[Graphics:Images/Labels2_gr_32.gif]](Images/Labels2_gr_32.gif)
![[Graphics:Images/Labels2_gr_33.gif]](Images/Labels2_gr_33.gif)
Adding a Legend
The Mathematica function Legend is part of the
Graphics` package. To use it, first load the package.
<< Graphics`Legend`
The two options to set are LegendPosition and
LegendSize. LegendPosition
can take values between
{0, 0} (lower-left corner of the graphic) and
{1, 1} (upper-right corner of the graphic). The parameters in LegendSize
are fractions of the total size of the graphic.
![[Graphics:Images/Labels2_gr_36.gif]](Images/Labels2_gr_36.gif)
![[Graphics:Images/Labels2_gr_37.jpg]](Images/Labels2_gr_37.jpg)
|