2
$\begingroup$

Here is the code I use to plot a graph

ant = Plot[{a3[t], n[t ], a1[t], a[t]}, {t, 0, 20},
 GridLines -> {{t0}, {1}}, Frame -> True, ImageSize -> 800, 
  MaxRecursion -> 15, PlotStyle ->
   {{Orange, ck}, {Black, ck, Dashed}, {{Red, ck}, 
     DotDashed}, {Darker[Green], Dotted, ck}}, 
  PlotRange -> {Automatic, {0, 2}}, 
  PlotLegends -> 
   Placed[{"x = 0.05", "y = 0.03", " z = 0.7", "E = 0.1", 
     "F = -0.01" }, {0.3, 0.75}], FrameLabel -> {"t", "a"}, 
  LabelStyle -> 
   Directive[FontFamily -> "Times", FontSize -> 25, Black], 
  GridLinesStyle -> Directive[Gray] ]

The png output is:

enter image description here

This graph has a couple of problems if you help me to fix. First how to increase the size of the FrameLabel (a,t) without increasing the size of the PlotLegends ?

In this code when I increase the FontSize in the LabelStyle it applies on both, so how to separate the FontSize of the FrameLabel and the FontSize of the PlotLegends?

Second: How to make the PlotStyle : (Dashed (Black), DotDashed (Red), Dotted (Green)) more distinct and apparent.

In short how to make my graph seems like for instance this graph:

enter image description here

$\endgroup$

3 Answers 3

2
$\begingroup$

I use arbitrary function for an example:

a[t_] = 0.01 t^2;
a1[t_] = 1 + Cos[.5 t];
a3[t_] = Exp[-0.1 t];
n[t_] = Tan[0.4 t]
ant = Plot[{a3[t], n[t], a1[t], a[t]}, {t, 0, 20}, 
  GridLines -> {{t0}, {1}}, Frame -> True, ImageSize -> 800, 
  MaxRecursion -> 15, 
  PlotStyle -> {{Orange, Thickness[0.008], ck}, {Black, ck, 
     Dashing[Large, Large], Thickness[0.008]}, {{Red, ck}, DotDashed, 
     Thickness[0.008]}, {Darker[Green], Thickness[0.008], Dotted, 
     ck}}, PlotRange -> {Automatic, {0, 2}}, 
  PlotLegends -> 
   Placed[{"x = 0.05", "y = 0.03", " z = 0.7", "E = 0.1", 
     "F = -0.01"}, {0.3, 0.75}], 
  FrameLabel -> {Style["t", Bold, Larger], Style["a", Bold, Larger]}, 
  LabelStyle -> 
   Directive[FontFamily -> "Times", FontSize -> 25, Black], 
  GridLinesStyle -> Directive[Gray]]

![enter image description here

$\endgroup$
3
  • $\begingroup$ Hello, great thanks. But I wonder about the PlotStyle of the red, green, and black lines, how can they appear like the blue(DotDashed), the green (Dashed), and the cyan (Dotted) lines in the example graph I have posted . There is a difference in thickness but still they look so clear in the example graph. $\endgroup$
    – Dr. phy
    Aug 9 at 9:20
  • 1
    $\begingroup$ You can play e.g. with "Dashing" look it up in the help. The thickness is controlled by "Thickness". $\endgroup$ Aug 9 at 9:25
  • $\begingroup$ Yeah, of course I know this. Thanks again. $\endgroup$
    – Dr. phy
    Aug 9 at 9:38
4
$\begingroup$

AbsoluteDashing is convenient to set the PlotStyle.

Plot[{Sqrt[x], Sqrt[2 x], Sqrt[3 x], Sqrt[4 x]}, {x, 0, 5}, 
 PlotStyle -> {{AbsoluteThickness[4], 
    Darker@Yellow}, {AbsoluteDashing[{10, 10}, 0, "Round"], 
    AbsoluteThickness[4], 
    Darker@Green}, {AbsoluteDashing[{1, 10}, 0, "Round"], 
    AbsoluteThickness[4], 
    Darker@Cyan}, {AbsoluteDashing[{10, 1, 10}, 0, "Round"], 
    AbsoluteThickness[4], Blue}}]

enter image description here

$\endgroup$
3
  • $\begingroup$ So awesome.. many thanks $\endgroup$
    – Dr. phy
    Aug 11 at 8:40
  • $\begingroup$ I have Mathematica 12, have you an idea why it doesn’t recognize 0, "Round"] option? $\endgroup$
    – Dr. phy
    Aug 11 at 9:09
  • 1
    $\begingroup$ @Dr.phy Maybe add CapForm in old version. Plot[{Sqrt[x], Sqrt[2 x], Sqrt[3 x], Sqrt[4 x]}, {x, 0, 5}, PlotStyle -> {{AbsoluteThickness[4], Darker@Yellow}, {AbsoluteDashing[{10, 10}, Automatic, CapForm["Round"]], AbsoluteThickness[4], Darker@Green}, {AbsoluteDashing[{1, 10}, Automatic, CapForm["Round"]], AbsoluteThickness[4], Darker@Cyan}, {AbsoluteDashing[{10, 1, 10}, Automatic, CapForm["Round"]], AbsoluteThickness[4], Blue}}] $\endgroup$
    – cvgmt
    Aug 11 at 9:13
2
$\begingroup$

You can style frame labels, increasing the font size:

FrameLabel -> {Style["t", 40], Style["a", 40]}

Then there are various settings to play with to change the PlotStyle (Thickness, Dashing...). Here is an example.

PlotStyle -> {{Orange, ck, Thickness[0.01]}, {Black, ck, 
   Dashing[{0.05, Small}], 
   Thickness[0.01]}, {{Red, ck, Thickness[0.01]}, 
   DotDashed}, {Darker[Green], Thickness[0.01], Dashing[{0.1, Small}],
    ck}}
$\endgroup$

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.