*** Input data files = two column table "x, y" < {True, True}, PlotStyle -> {{Thickness[0.01], GrayLevel[0.5]} , Dashing[{0.005}]}, SymbolShape -> {PlotSymbol[Triangle, 4, Filled -> False], PlotSymbol[Box, 2, Filled -> False]}, SymbolStyle -> {GrayLevel[0], GrayLevel[0.5]}, PlotRange -> {{1982, 2006}, {0.8, 1.2}}, AxesOrigin -> {1982, 0.8}, PlotLegend -> {StyleForm["clothing", FontFamily -> "Times", FontSize -> 11], StyleForm["liquor", FontFamily -> "Times",FontSize -> 11]}, LegendBorder -> GrayLevel[1], LegendPosition -> {-1,-1}, LegendSpacing -> 0.0001, FrameLabel -> {StyleForm["year", FontFamily -> "Times", FontSize -> 11], StyleForm["MAR/APR ratio", FontFamily -> "Times",FontSize -> 11]}, RotateLabel -> False, Frame -> True] ===================================================== *** Input data files = two column table "x, y" < {True, True,True, True,True, True,True, True}, PlotStyle -> {Thickness[0.0] , Thickness[0.0], Thickness[0.0] , Thickness[0.0], Thickness[0.0] , Thickness[0.0], Thickness[0.0] , Thickness[0.0]}, SymbolShape -> {PlotSymbol[Box, 3, Filled -> True], PlotSymbol[Triangle, 5, Filled -> True], PlotSymbol[Star, 5, Filled -> True], PlotSymbol[Diamond, 6, Filled -> True], PlotSymbol[Box, 4, Filled ->True], PlotSymbol[Triangle, 6, Filled -> True], PlotSymbol[Star, 6, Filled -> True], PlotSymbol[Diamond, 6, Filled -> True]}, SymbolStyle -> {GrayLevel[0], GrayLevel[0], GrayLevel[0], GrayLevel[0], GrayLevel[0.6], GrayLevel[0.6], GrayLevel[0.6], GrayLevel[0.6]}, PlotRange -> {{1982, 2006}, {0.8, 1.2}}, AxesOrigin -> {1982, 0.8}, PlotLegend -> {StyleForm["clothing", FontFamily -> "Times", FontSize -> 11], StyleForm["liquor", FontFamily -> "Times",FontSize -> 11], StyleForm["appliances", FontFamily -> "Times", FontSize -> 11], StyleForm["hardware", FontFamily -> "Times",FontSize -> 11], StyleForm["other", FontFamily -> "Times", FontSize -> 11], StyleForm["pharmaceutical", FontFamily -> "Times",FontSize -> 11], StyleForm["groceries", FontFamily -> "Times", FontSize -> 11], StyleForm["takeaway", FontFamily -> "Times",FontSize -> 11]}, LegendBorder -> GrayLevel[1], LegendPosition -> {-1,-1}, LegendSpacing -> 0.0001, FrameLabel -> {StyleForm["year", FontFamily -> "Times", FontSize -> 11], StyleForm["MAR/APR ratio", FontFamily -> "Times",FontSize -> 11]}, RotateLabel -> False, Frame -> True] *** Plot Lines at specific locations: Doesn't work if have legend in the plot! Show[g, {Graphics[{Hue[1.0], Line[{{1983, 0.8}, {1983,1.2}}]}], Graphics[{Hue[1.0], Line[{{1986, 0.8}, {1986,1.2}}]}], Graphics[{Hue[1.0], Line[{{1988, 0.8}, {1988,1.2}}]}], Graphics[{Hue[1.0], Line[{{1989, 0.8}, {1989,1.2}}]}], Graphics[{Hue[1.0], Line[{{1991, 0.8}, {1991,1.2}}]}], Graphics[{Hue[1.0], Line[{{1994, 0.8}, {1994,1.2}}]}], Graphics[{Hue[1.0], Line[{{1997, 0.8}, {1997,1.2}}]}], Graphics[{Hue[1.0], Line[{{1999, 0.8}, {1999,1.2}}]}], Graphics[{Hue[1.0], Line[{{2002, 0.8}, {2002,1.2}}]}], Graphics[{Hue[1.0], Line[{{2005, 0.8}, {2005, 1.2}}]}]}] ===================================================== *** With Error Bars: Input data files = " x y ErrorBar[Delta_y]" < {True}, PlotStyle -> {Thickness[0.0]}, SymbolShape -> {PlotSymbol[Box, 3, Filled -> True]}, PlotRange -> {{1982, 2006}, {0.9, 1.15}}, AxesOrigin -> {1982, 0.9}, FrameLabel -> {StyleForm["year", FontFamily -> "Times", FontSize -> 11], StyleForm[" ratio", FontFamily -> "Times",FontSize -> 11]}, RotateLabel -> False, Frame -> True] ===================================================== *** Current working directory: "Directory[]" *** cd to desired directory: SetDirectory[""] *** list filenames in dir: Filenames[""] ===================================================== *** Exporting plot to jpg filename: Export["Ratio_averages.jpg", g, ImageSize -> 300, ImageResolution -> 200] *** Exporting to ".eps" or ".pdf": Export["Ratio_averages.pdf", g] Where "g" points to graphic object (see above). ===================================================== *** Averaged Data with model: < {False, True, True}, PlotStyle -> {Thickness[0.0], {Hue[1.0],Thickness[0.005]}, {Hue[0.6],Thickness[0.005]}}, SymbolShape -> {PlotSymbol[Box, 3, Filled -> True], PlotSymbol[Box, 1, Filled -> False], PlotSymbol[Box, 1, Filled -> False]}, SymbolStyle -> {GrayLevel[0], Hue[1.0], Hue[0.6]}, PlotRange -> {{1982, 2006}, {0.9, 1.15}}, AxesOrigin -> {1982, 0.9}, FrameLabel -> {StyleForm["Year", FontFamily -> "Times", FontSize -> 13], StyleForm[" ratio", FontFamily -> "Times",FontSize -> 13]}, RotateLabel -> False, Frame -> True] Show[g, {Graphics[{Hue[0.4], Line[{{1983, 0.8}, {1983,1.}}]}], Graphics[{Hue[0.4], Line[{{1986, 0.8}, {1986,1.}}]}], Graphics[{Hue[0.4], Line[{{1988, 0.8}, {1988,1.}}]}], Graphics[{Hue[0.4], Line[{{1989, 0.8}, {1989,1.}}]}], Graphics[{Hue[0.4], Line[{{1991, 0.8}, {1991,1.}}]}], Graphics[{Hue[0.4], Line[{{1994, 0.8}, {1994,1.}}]}], Graphics[{Hue[0.4], Line[{{1997, 0.8}, {1997,1.}}]}], Graphics[{Hue[0.4], Line[{{1999, 0.8}, {1999,1.}}]}], Graphics[{Hue[0.4], Line[{{2002, 0.8}, {2002,1.}}]}], Graphics[{Hue[0.4], Line[{{2005, 0.8}, {2005,1.}}]}], Graphics[{Line[{{1982, 1.0333}, {2006, 1.0333}}]}]}] ===================================================== *** NonLinear Regression. Model below doesn't work because it is a piecewise function and derivatives diverge in the Jacobian. << Statistics`NonlinearFit` data1 = Import["/Users/stacey/fmasci/n_m_w7h4_obsratio.dat","Table"] h = 4 w = 7 NonlinearRegress[data1, (31/30) ((1 + (A/(C + 1))(((31 - m)^(C + 1)) - ((31 - n - m)^(C + 1))) - B m)/ (1 + ((31/30) A/(C + 1))((w - n)^(C + 1)) - (31/30) B (h - m))), {n, m}, {{A, 0.006}, {B, 0.0034}, {C, -0.5}}, MaxIterations->300, RegressionReport -> {BestFitParameters, ParameterCITable, AsymptoticCorrelationMatrix, ANOVATable, FitResiduals, StartingParameters}, ShowProgress->True] ======================================================== *** Plot points to represent 2D confidence region. < {False, False}, SymbolShape -> {PlotSymbol[Box, 3, Filled -> True], PlotSymbol[Triangle, 6, Filled -> True]}, SymbolStyle -> {Hue[0.6], Hue[1.0]}, PlotRange -> {{0, 16}, {0, 8}}, AxesOrigin -> {-1, -5}, FrameLabel -> {StyleForm["p parameter", FontFamily -> "Times", FontSize -> 13], StyleForm["w parameter (days)", FontFamily -> "Times",FontSize -> 13]}, RotateLabel -> False, Frame -> True] ======================================================== *** To read a text file with data in multiple columns and rows and want to plot specific columns from the file. # First store all data into a matrix, here it's 15 columns and 12 rows. # Then read "All" rows 1 -> 12 and specific columns (x, y): < {False, False}, SymbolShape -> {PlotSymbol[Box, 2, Filled -> True], PlotSymbol[Box, 2, Filled -> False]}, SymbolStyle -> {Hue[0.6], Hue[1.0]}, PlotRange -> {{0.95, 1.05}, {0.95, 1.05}}, AxesOrigin -> {1, 1}, PlotLegend -> {StyleForm["MAR irreg", FontFamily -> "Times", FontSize -> 12], StyleForm["APR irreg", FontFamily -> "Times",FontSize -> 12]}, LegendBorder -> GrayLevel[1], LegendPosition -> {1.07,0.05}, LegendSpacing -> -0.3, FrameLabel -> {StyleForm["Without EP Corr.", FontFamily -> "Times", FontSize -> 13], StyleForm["SEASABS EP Corr.", FontFamily -> "Times",FontSize -> 13]}, RotateLabel -> False, Frame -> True] oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo data1 = m[[All, {6, 4}]] data2 = m[[All, {7, 5}]] g = MultipleListPlot[data1, data2, PlotJoined -> {False, False}, SymbolShape -> {PlotSymbol[Box, 2, Filled -> True], PlotSymbol[Box, 2, Filled -> False]}, SymbolStyle -> {Hue[0.6], Hue[1.0]}, PlotRange -> {{0.95, 1.05}, {0.95, 1.05}}, AxesOrigin -> {1, 1}, PlotLegend -> {StyleForm["MAR irreg", FontFamily -> "Times", FontSize -> 12], StyleForm["APR irreg", FontFamily -> "Times",FontSize -> 12]}, LegendBorder -> GrayLevel[1], LegendPosition -> {1.07,0.05}, LegendSpacing -> -0.3, FrameLabel -> {StyleForm["Model Fit: w=6;h=4;p=0.56", FontFamily -> "Times", FontSize -> 13], StyleForm["SEASABS EP Corr.", FontFamily -> "Times",FontSize -> 13]}, RotateLabel -> False, Frame -> True] oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo data1 = m[[All, {8, 4}]] data2 = m[[All, {9, 5}]] g = MultipleListPlot[data1, data2, PlotJoined -> {False, False}, SymbolShape -> {PlotSymbol[Box, 2, Filled -> True], PlotSymbol[Box, 2, Filled -> False]}, SymbolStyle -> {Hue[0.6], Hue[1.0]}, PlotRange -> {{0.95, 1.05}, {0.95, 1.05}}, AxesOrigin -> {1, 1}, PlotLegend -> {StyleForm["MAR irreg", FontFamily -> "Times", FontSize -> 12], StyleForm["APR irreg", FontFamily -> "Times",FontSize -> 12]}, LegendBorder -> GrayLevel[1], LegendPosition -> {1.07,0.05}, LegendSpacing -> -0.3, FrameLabel -> {StyleForm["w=7;h=4;p=2", FontFamily -> "Times", FontSize -> 13], StyleForm["SEASABS EP Corr.", FontFamily -> "Times",FontSize -> 13]}, RotateLabel -> False, Frame -> True] oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo data1 = m[[All, {10, 4}]] data2 = m[[All, {11, 5}]] g = MultipleListPlot[data1, data2, PlotJoined -> {False, False}, SymbolShape -> {PlotSymbol[Box, 2, Filled -> True], PlotSymbol[Box, 2, Filled -> False]}, SymbolStyle -> {Hue[0.6], Hue[1.0]}, PlotRange -> {{0.95, 1.05}, {0.95, 1.05}}, AxesOrigin -> {1, 1}, PlotLegend -> {StyleForm["MAR irreg", FontFamily -> "Times", FontSize -> 12], StyleForm["APR irreg", FontFamily -> "Times",FontSize -> 12]}, LegendBorder -> GrayLevel[1], LegendPosition -> {1.07,0.05}, LegendSpacing -> -0.3, FrameLabel -> {StyleForm["w=7;h=0;p=2", FontFamily -> "Times", FontSize -> 13], StyleForm["SEASABS EP Corr.", FontFamily -> "Times",FontSize -> 13]}, RotateLabel -> False, Frame -> True] oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo data1 = m[[All, {12, 4}]] data2 = m[[All, {13, 5}]] g = MultipleListPlot[data1, data2, PlotJoined -> {False, False}, SymbolShape -> {PlotSymbol[Box, 2, Filled -> True], PlotSymbol[Box, 2, Filled -> False]}, SymbolStyle -> {Hue[0.6], Hue[1.0]}, PlotRange -> {{0.95, 1.05}, {0.95, 1.05}}, AxesOrigin -> {1, 1}, PlotLegend -> {StyleForm["MAR irreg", FontFamily -> "Times", FontSize -> 12], StyleForm["APR irreg", FontFamily -> "Times",FontSize -> 12]}, LegendBorder -> GrayLevel[1], LegendPosition -> {1.07,0.05}, LegendSpacing -> -0.3, FrameLabel -> {StyleForm["w=14;h=4;p=2", FontFamily -> "Times", FontSize -> 13], StyleForm["SEASABS EP Corr.", FontFamily -> "Times",FontSize -> 13]}, RotateLabel -> False, Frame -> True] oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo data1 = m[[All, {14, 4}]] data2 = m[[All, {15, 5}]] g = MultipleListPlot[data1, data2, PlotJoined -> {False, False}, SymbolShape -> {PlotSymbol[Box, 2, Filled -> True], PlotSymbol[Box, 2, Filled -> False]}, SymbolStyle -> {Hue[0.6], Hue[1.0]}, PlotRange -> {{0.95, 1.05}, {0.95, 1.05}}, AxesOrigin -> {1, 1}, PlotLegend -> {StyleForm["MAR irreg", FontFamily -> "Times", FontSize -> 12], StyleForm["APR irreg", FontFamily -> "Times",FontSize -> 12]}, LegendBorder -> GrayLevel[1], LegendPosition -> {1.07,0.05}, LegendSpacing -> -0.3, FrameLabel -> {StyleForm["w=1;h=0;p=2", FontFamily -> "Times", FontSize -> 13], StyleForm["SEASABS EP Corr.", FontFamily -> "Times",FontSize -> 13]}, RotateLabel -> False, Frame -> True] ======================================================== *** Plot 3D graph from table list of numbers: data = ReadList["P:\My Documents\FrankMasci\Easter\3DRPlot.txt", Table[Number,{8}], 5] g = ListPlot3D[data, AxesLabel -> {"n", "m", "MAR/APR ratio"}, ViewPoint -> {3, -4.5, 1.8}, MeshRange -> {{0, 7}, {0, 4}}] ========================================================