Mathematica- adjusting FrameTicks option

  • Mathematica
  • Thread starter issacnewton
  • Start date
  • Tags
    Mathematica
In summary, to plot data in Mathematica, you can use the ListLinePlot command. Make sure to specify the correct PlotRange and FrameTicks to get the desired output.
  • #1
issacnewton
1,026
36
Hi

I want to plot the data in Mathematica

Code:
data={{0.608, 0.05}, {0.43, 0.1}, {0.304, 0.2}, {0.248, 0.3}, {0.215, 
  0.4}, {0.192, 0.5}}

I am trying to use ListLinePlot. The problem does not say to use any particular command.
But I chose ListLinePlot... Here is the code I am using.

Code:
ListLinePlot[data, InterpolationOrder -> 3,
 Frame -> True, PlotRange -> {0.01, 0.505}, ImageSize -> 450,
 FrameLabel -> {{"P (Martian atm)", None}, {"V (Martian L)", None}},
 FrameTicks -> {{{0.1, .2, .3, .4, .5}, Automatic}, {Automatic, 
    Automatic}}]

the output I get is shown in output.jpg

But I need the output as shown in correct.jpg...

So how do I modify my program. This is a problem from Patrick Tam's book on mathematica.
 

Attachments

  • output.jpg
    output.jpg
    8.7 KB · Views: 481
  • correct.jpg
    correct.jpg
    13.9 KB · Views: 389
Physics news on Phys.org
  • #2
Thanks in Advance.The code you provided should work, but it looks like the problem may be with the PlotRange and FrameTicks commands. Try changing the PlotRange to {0, 0.6} and the FrameTicks to {{{0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6}, Automatic}, {Automatic, Automatic}}. That should give you the correct graph.
 

Related to Mathematica- adjusting FrameTicks option

1. How can I customize the tick marks on my graph using Mathematica's FrameTicks option?

The FrameTicks option allows you to specify the positions and labels of the tick marks on the axes of your graph. To customize them, you can use the FrameTicks->{{xTicks},{yTicks}} syntax, where you replace xTicks and yTicks with the desired tick mark values. You can also use the Automatic or All options to have Mathematica automatically generate the ticks based on the data in your graph.

2. Can I adjust the spacing of the tick marks using the FrameTicks option?

Yes, you can adjust the spacing of the tick marks by using the FrameTicks->{{xTicks, xStep},{yTicks, yStep}} syntax, where xStep and yStep represent the desired spacing between the tick marks on the x and y axes, respectively.

3. How can I change the font size and style of the tick labels?

To change the font size and style of the tick labels, you can use the FrameTicksStyle->{{FontFamily, FontSize, FontStyle}} syntax, where you replace FontFamily, FontSize, and FontStyle with your desired values. You can also use the FontFamily and FontWeight options to change the font and weight of the tick labels separately.

4. Is it possible to have tick marks on only one side of my graph using the FrameTicks option?

Yes, you can specify where you want the tick marks to appear on your graph by using the FrameTicks->{Left, Right, Bottom, Top} syntax. For example, if you only want tick marks on the bottom and left sides of your graph, you would use FrameTicks->{Automatic, Automatic, Automatic, None}.

5. How do I add custom tick labels using the FrameTicks option?

You can add custom tick labels by using the FrameTicks->{{xTicks, xLabels},{yTicks, yLabels}} syntax, where you replace xLabels and yLabels with your desired label values. You can also use the FrameLabel option to add labels to the axes of your graph.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
6K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
6K
  • Advanced Physics Homework Help
Replies
4
Views
8K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
942
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
4K
  • Advanced Physics Homework Help
Replies
1
Views
6K
Back
Top