0
$\begingroup$

I am looking to discover a way to make a plot similar to this one. enter image description here

I found Gridlines of a framed plot with a background cannot be white?

But I cannot figure out how to turn off the axes lines but keep the axes labels? Here is some example code and I cannot figure out how to turn the framelabels back int black without turning the frame into black?

linewidth = .01; Imsize = 500;
SetOptions[Plot, 
  BaseStyle -> {FontFamily -> "Helvetica", FontSize -> 18}, 
  ImageSize -> Imsize];    
ttt = Plot[Sin[t], {t, -20, 20}, 
        PlotStyle -> {Red, Thickness[linewidth]}, Frame -> False, 
        FrameLabel -> {"d [mm]", "h [mm]"}, ImageSize -> Imsize,   
        AspectRatio -> Full][[1]];
    Plot[Sin[t], {t, -20, 20}, PlotStyle -> {Red, Thickness[linewidth]}, 
     Frame -> False, FrameLabel -> {"d [mm]", "h [mm]"}, 
     Method -> {"GridLinesInFront" -> True}, GridLines -> Automatic, 
     GridLinesStyle -> Directive[AbsoluteThickness[2], White], 
     AxesStyle -> {{White}, {White}}, LabelStyle -> Black, 
     ImageSize -> Imsize,   AspectRatio -> Full, 
     Prolog -> {{LightGray, Opacity[0.2], 
        Rectangle[Scaled[{.02, 0.02}], Scaled[{1, 1}]]}}, Epilog -> ttt]

As you can see from this example the actual axes labels are white and not visible!

enter image description here

$\endgroup$
2
  • $\begingroup$ Note that: linewidth and Imsize are undefined $\endgroup$
    – bmf
    Commented Feb 9, 2023 at 5:21
  • $\begingroup$ inserted these now... $\endgroup$
    – DrKwantum
    Commented Feb 9, 2023 at 5:58

1 Answer 1

1
$\begingroup$

Edit 2

pl = Plot[Sin[x], {x, 0, 2 Pi},
    PlotStyle -> {
      Red,
      Thickness[0.03]
      }
    ][[1]];
Plot[Sin[x], {x, 0, 2 Pi},
 PlotStyle -> None,
 Frame -> True,
 FrameTicksStyle ->
  Directive[11, Opacity[0], FontOpacity -> 13, 
   FontFamily -> "Zapfino", Darker@Green],
 FrameLabel ->
  {
   Style["x", 23, FontFamily -> "Chalkduster", Black, Bold],
   Style["sin(x)", 23, FontFamily -> "Chalkduster", Black, Bold]
   },
 Method -> {"GridLinesInFront" -> True},
 GridLines -> Automatic, 
 GridLinesStyle -> Directive[AbsoluteThickness[2], White],
 Prolog -> {{LightGray, Opacity[0.5], 
    Rectangle[Scaled[{0, 0}], Scaled[{1, 1}]]}},
 Epilog -> pl]

p

Edit 1

pl = Plot[Sin[x], {x, 0, 2 Pi}, 
    TicksStyle -> Directive[11, Opacity[0], FontOpacity -> 0.01]][[1]];
Plot[Sin[x], {x, 0, 2 Pi},
 PlotStyle -> None,
 Frame -> True,
 FrameTicksStyle -> Directive[11, Opacity[0], FontOpacity -> 1],
 FrameLabel -> {
   Style["x", 23, FontFamily -> "Chalkduster", Black, Bold],
   Style["sin(x)", 23, FontFamily -> "Chalkduster", Black, Bold]
   },
 Method -> {"GridLinesInFront" -> True},
 GridLines -> Automatic, 
 GridLinesStyle -> Directive[AbsoluteThickness[2], White], 
 Prolog -> {{LightGray, Opacity[0.5], 
    Rectangle[Scaled[{0, 0}], Scaled[{1, 1}]]}},
 Epilog -> pl]

plot

Original

If I understand correctly

pl = Plot[Sin[x], {x, 0, 2 Pi}, AxesLabel -> {"x", "sin(x)"}][[1]];
Plot[Sin[x], {x, 0, 2 Pi},
 PlotStyle -> None,
 Frame -> True,
 FrameLabel ->
  {Style["x", 23, FontFamily -> "Chalkduster", Black, Bold], 
   Style["sin(x)", 23, FontFamily -> "Chalkduster", Black, Bold]},
 Method -> {"GridLinesInFront" -> True},
 GridLines -> Automatic,
 GridLinesStyle -> Directive[AbsoluteThickness[2], White], 
 Prolog -> {{LightGray, Opacity[0.5], 
    Rectangle[Scaled[{0, 0}], Scaled[{1, 1}]]}},
 Epilog -> pl]

Blockquote

$\endgroup$
2
  • $\begingroup$ Thanks but I wish to remove the axes ticks and frame lines altogether but keep the axes numbers and labels... $\endgroup$
    – DrKwantum
    Commented Feb 9, 2023 at 5:57
  • $\begingroup$ @DrKwantum please see the edit and let me know $\endgroup$
    – bmf
    Commented Feb 9, 2023 at 6:07

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