1
$\begingroup$

I am producing in my notebookfile many plots with the following example code:

plot = Framed[
   ListPlot[data, Joined -> True, Frame -> True, 
    PlotStyle -> {RGBColor[0, 0, 1], Thickness[0.002]}, 
    FrameLabel -> {{"y", ""}, {"x", ""}}, 
    BaseStyle -> {FontWeight -> "Bold", FontSize -> 40, 
      FontFamily -> "Calibri"}, ImageSize -> 2000, 
    ImagePadding -> {{All, All}, {All, 50}}]];

How can I avoid to use for each new plot the same repeating attributes and only pass through the data to each new ListPlot call?

$\endgroup$
3
  • $\begingroup$ Why not write a subroutine collecting all your customizations? $\endgroup$
    – J. M.'s torpor
    Mar 14 '16 at 11:20
  • $\begingroup$ Is this the only possibility, or can one pass through a bunch of attributes differently, so that still ListPlot is called? $\endgroup$
    – mrz
    Mar 14 '16 at 11:33
  • $\begingroup$ see the documentation for SetOptions, it will let you do exactly what you ask for. It might be a good idea to remember what the original settings were so you can restore them once you are done. Restarting the kernel will clear those settings as well... $\endgroup$ Mar 14 '16 at 11:42
5
$\begingroup$

Something like this?

    opts = Sequence[
      Joined -> True, 
      Frame -> True, 
      PlotStyle -> {RGBColor[0, 0, 1], Thickness[0.002]}, 
      FrameLabel -> {{"y", ""}, {"x", ""}}, 
      BaseStyle -> {FontWeight -> "Bold", FontSize -> 40, 
      FontFamily -> "Calibri"}, ImageSize -> 2000, 
      ImagePadding -> {{All, All}, {All, 50}}
    ];    

    plot1 = Framed[ ListPlot[data1, opts]];
    plot2 = Framed[ ListPlot[data2, opts]];
    ...
$\endgroup$
1
  • $\begingroup$ That is exactly what I was looking for ... great thanks $\endgroup$
    – mrz
    Mar 14 '16 at 13:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.