Mathematica How to Specify Tick Number and Distance in Mathematica Plot?

  • Thread starter Thread starter iva_bg
  • Start date Start date
  • Tags Tags
    Mathematica Plot
AI Thread Summary
To specify the number of ticks labeled at equal distances in a plot without explicitly listing positions, users can utilize the Ticks option in Mathematica. For example, Ticks -> {Range[-1, 5, 2], Automatic} will label every other integer on the x-axis while automatically labeling the y-axis. However, for DateListPlot, the Ticks option requires tick values in a specific format, such as Ticks -> {{{2007, 4, 12}, {2008, 4, 18}}, Automatic}. Users can either manually input a list of desired tick values or create a function to generate these values programmatically.
iva_bg
Messages
8
Reaction score
0
Hello,

does anyone know how to specify the number of ticks to be labelled in a plot at an equal distance, without writing the list of positions explicitly?

Thanks!
 
Physics news on Phys.org
Ticks -> {Range[-1, 5, 2], Automatic}

will label every other integer between -1 and 5 on the x-axis and auto label the y axis. Modify this as necessary for your application.
 
Nothing happens... Do you know if that works with DateListPlot?
 
http://reference.wolfram.com/mathematica/ref/DateListPlot.html

Then click on Options then click on Ticks

and you see that DateListPlot Ticks requires "tick values" in the form
Ticks->{{{2007,4,12},{2008,4,18}},Automatic}
So you either enter a list like this for your desired "tick values" or you craft up a function to generate the tick values you want.
 

Similar threads

Replies
1
Views
2K
Replies
2
Views
2K
Replies
2
Views
1K
Replies
1
Views
2K
Replies
1
Views
2K
Replies
3
Views
5K
Replies
3
Views
2K
Back
Top