(* ::Package:: *) (* ::Title:: *) (*SetOptions4c*) (* ::Subtitle:: *) (*Davi C. Rodrigues (2015, 2016, 2017, 2018)*) (* ::Text:: *) (*v4c is the first to use ELPlot in place of ErrorBarPlots. The geometric bullest now come from ELPlot.*) Off[General::precw] ;(* Removes warnings on the computations being done with high precision. Doesn't work? *) Off[NIntegrate::precw]; Off[NDSolve::precw]; Off[RandomReal::precw]; Print["TF = TableForm. MF = MatrixForm. Geometric bullets loaded."]; Print["=> Standard options and packages loaded. Last update 02/2016 (for Mathematica 10, uses CustomTicks.m. Added writeYourCSV and readYourCSV)."]; (* ::Text:: *) (*Definition of special variables*) TF = TableForm; MF = MatrixForm; SetOptions[LinTicks, MajorTickLength->{0.025,0},MinorTickLength->{0.010,0}, MajorTickStyle-> AbsoluteThickness[1],MinorTickStyle-> AbsoluteThickness[1] ]; (*Options for the ticks, depends on CustomTicks.m*) generaloptions = Delete[{Frame-> True, Axes -> False, GridLines -> Automatic, FrameStyle -> 20, GridLinesStyle -> Directive[Dashed, LightGray, AbsoluteThickness[1]], AspectRatio -> 1, LabelStyle->{FontFamily->"Times"}},0]; plotstyleoptions[thickness_] = PlotStyle->{Directive[GrayLevel[0],AbsoluteThickness[thickness]],Directive[RGBColor[0.34398, 0.49112, 0.89936],AbsoluteThickness[thickness]],Directive[RGBColor[0.97, 0.606, 0.081],AbsoluteThickness[thickness]],Directive[RGBColor[0.448, 0.69232, 0.1538],AbsoluteThickness[thickness]],Directive[RGBColor[0.62168, 0.2798, 0.6914],AbsoluteThickness[thickness]],Directive[RGBColor[0.91, 0.318, 0.243],AbsoluteThickness[thickness]],Directive[RGBColor[0.09096, 0.6296, 0.85532],AbsoluteThickness[thickness]],Directive[RGBColor[0.46056, 0.40064, 0.81392],AbsoluteThickness[thickness]],Directive[RGBColor[0.94, 0.462, 0.162],AbsoluteThickness[thickness]],Directive[RGBColor[0., 0.7, 0.7],AbsoluteThickness[thickness]],Directive[RGBColor[0.827051, 0.418034, 0.0243459],AbsoluteThickness[thickness]],Directive[RGBColor[0.5511749434976025, 0.32014794962639853`, 0.8720626412559938],AbsoluteThickness[thickness]],Directive[RGBColor[0.72694101250947, 0.7196601125010522, 0.],AbsoluteThickness[thickness]],Directive[RGBColor[0.8680706456216862, 0.2563858708756628, 0.30321559063052295`],AbsoluteThickness[thickness]],Directive[RGBColor[0.2418693812442152, 0.5065044950046278, 0.9902432574930582],AbsoluteThickness[thickness]],Directive[RGBColor[0.9573908706237908, 0.5369543531189542, 0.11504464931576472`],AbsoluteThickness[thickness]],Directive[GrayLevel[0],AbsoluteThickness[thickness]]}; colorplot[i_] := plotstyleoptions[1.8][[2,i,1]]; (*Calls the i-th color used in plotstyleoptions*) frameticksoptions = FrameTicks->{{LinTicks,StripTickLabels[LinTicks]}, {LinTicks,StripTickLabels[LinTicks]}}; circleplotmarkersoptions = PlotMarkers ->{circle[Black], circle[RGBColor[0.34398, 0.49112, 0.89936]], circle[RGBColor[0.97, 0.606, 0.081]], circle[RGBColor[0.91, 0.318, 0.243]]}; loglogframeticksoptions = {{Table[{10^i, Superscript[10, i]}, {i, -20, 20}], Table[{10^i, ""}, {i, -20, 20}]}, {Table[{10^i, Superscript[10, i]}, {i, -20, 20}], Table[{10^i, ""}, {i, -20, 20}]}}; (*Put loglogframeticks after FrameTicks \[Rule] *) logframeticksoptions = {{Table[{10^i, Superscript[10, i]}, {i, -20, 20}], Automatic}, {Automatic, Automatic}}; (*Put loglogframeticks after FrameTicks \[Rule] *) (* ::Text:: *) (*The new functions:*) SetAttributes[nPlot, HoldFirst] nPlot[Args___] := Plot[Args, Evaluate[generaloptions], Evaluate[frameticksoptions], Evaluate[plotstyleoptions[1.8]], PlotRangePadding->None]; SetAttributes[nParametricPlot, HoldFirst] nParametricPlot[Args___] := ParametricPlot[Args, Evaluate[generaloptions], Evaluate[frameticksoptions], Evaluate[plotstyleoptions[1.8]], PlotRangePadding->None]; nListPlot[Args___] := ListPlot[Args, Evaluate[generaloptions], Evaluate[frameticksoptions], Evaluate[circleplotmarkersoptions]]; nListLogPlot[Args___] := ListLogPlot[Args, Evaluate[generaloptions], Evaluate[circleplotmarkersoptions]]; (*Does not use customticks*) nListLogLogPlot[Args___] := ListLogLogPlot[Args, Evaluate[generaloptions], Evaluate[circleplotmarkersoptions]]; (*Does not use customticks*) nRegionPlot[Args___] := RegionPlot[Args, Evaluate[generaloptions], Evaluate[frameticksoptions], PlotRangePadding->None]; nErrorListPlot[Args___] := ErrorListPlot[Args, Evaluate[generaloptions], Evaluate[frameticksoptions], Evaluate[circleplotmarkersoptions], Evaluate[plotstyleoptions[1]]]; (*LogPlot, LogLinearPlot, LogLogPlot,*) (* ::Text:: *) (*Extra, general purpose, definitions*) writeYourCSV[file_String,list_List?MatrixQ]:= With[{str=OpenWrite[file,PageWidth->Infinity],len=Length[list[[1]]]}, Scan[ Write[str,Sequence@@(Flatten[Table[{FortranForm[#[[i]]],OutputForm[","]},{i,len-1}]])~Join~{FortranForm[#[[len]]]}]&, list ]; Close[str]; ]; (*Speeds the Export for csv files. From http://mathematica.stackexchange.com/questions/35371/speeding-up-import-and-export-in-csv-format*) readYourCSV[file_String?FileExistsQ, n_Integer] := Module[{str = OpenRead[file], data}, data = ReadList[str, Table[Record, {n}], RecordSeparators -> {",", "\n"}]; Close[str]; ReleaseHold[ToExpression[data, InputForm, Hold] /. {Plus[Times[x_, E | e], y_] :> x * 10 ^ y}] ]; (*Speeds the import of csv files. From http://mathematica.stackexchange.com/questions/35371/speeding-up-import-and-export-in-csv-format*)