Message Boards Message Boards

0
|
3391 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Combine GridLines and Ticks in a Plot?

Posted 5 years ago

MMA 11.3. I can add GridLines to a Plot (GridLines -> Automatic), but then when I try to add Ticks to the same plot using Ticks -> {Range[0, 2 pi, pi/2}], the Grid lines go away. Here are screeshots of 2 successive input cells.

enter image description here enter image description here

Attachment

Attachments:
POSTED BY: Thomas Seibel

Thomas,

You need to reverse things a bit. Specify the Gridlines and use Ticks->Automatic:

For example:

Plot[Sin[x], {x, 0, 2* Pi}, 
 GridLines -> {Range[0, 2 Pi, Pi/2], Automatic}, 
 Ticks -> Automatic]

or Specify both Gridlines and Ticks if you want to control the ticks more precisely, such as:

Plot[Sin[x], {x, 0, 2* Pi}, 
 GridLines -> {Range[0, 2 Pi, Pi/2], Automatic}, 
 Ticks -> {Range[0, 2 Pi, Pi/2], Automatic}]

Regards,

Neil

POSTED BY: Neil Singer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract