0

I would like to draw a simple 2D graphics with a frame, without any FrameTicks, but still having central axes with ticks. The code is this :

Plot[
LegendreP[3, x], {x, -1, 1},
PlotPoints -> Automatic,
PlotRange -> {-1, 1},
PlotStyle -> Directive[Thick, RGBColor[0.00, 0.40, 0.80]],
Frame -> True,
FrameTicks -> None,
Axes -> True,
Ticks -> True,
AxesOrigin -> {0, 0},
AxesStyle -> Directive[Gray],
GridLines -> Automatic,
GridLinesStyle -> Directive[Gray, Dashed],
Ticks -> Automatic,
PerformanceGoal -> "Quality"
]

I believed that would be easy and pretty standard. Apparently, I was wrong (?). The documentation didn't tell anything about this combination, and the site didn't helped me much with this.

So how do you add ticks on both central axes ? The command Ticks -> True doesn't seem to make a diference.

Cham
  • 4,093
  • 21
  • 36

2 Answers2

5

Since all you want is a frame, use Framed

Framed[Plot[LegendreP[3, x], {x, -1, 1},
  PlotRange -> All,
  PlotStyle -> Directive[Thick,
    RGBColor[0.00, 0.40, 0.80]],
  Axes -> True,
  GridLines -> Automatic,
  GridLinesStyle ->
   Directive[Gray, Dashed],
  Ticks -> True,
  PerformanceGoal -> "Quality"]]

enter image description here

Bob Hanlon
  • 157,611
  • 7
  • 77
  • 198
1

Maybe by using the Overlay command for two plots: one without frame and another one without axes

   Overlay[{Plot[LegendreP[3, x], {x, -1, 1}, PlotPoints -> Automatic, 
   PlotRange -> Full, 
   PlotStyle -> Directive[Thick, RGBColor[0.00, 0.40, 0.80]], 
   Frame -> False, Axes -> True, AxesOrigin -> {0, 0}, 
   AxesStyle -> Directive[Gray], GridLines -> Automatic, 
   GridLinesStyle -> Directive[Gray, Dashed], Ticks -> Automatic, 
   PerformanceGoal -> "Quality", ImagePadding -> All, Frame -> True], 
   Plot[None, {x, -1, 1}, PlotPoints -> Automatic, PlotRange -> Full, 
   PlotStyle -> Directive[Thick, RGBColor[0.00, 0.40, 0.80]], 
   Frame -> True, FrameTicks -> None, Axes -> False, Ticks -> True, 
   AxesOrigin -> {0, 0}, AxesStyle -> Directive[Gray], 
   Ticks -> Automatic, PerformanceGoal -> "Quality"]}]

enter image description here

demm
  • 1,533
  • 9
  • 13