Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am unable to change the frameticks for my list plot.

I am trying to plot a growth rate omega function which looks like this:

Clear[\[Omega]3, \[Omega], \[Epsilon], h, K1, \[Delta], q, Bi, m]
\[Omega]3 = \[Epsilon]/((h + K1)^2) - h^3 q^4 - Bo h^2 q^2 + 
  m q^2 h^2/((h + K1)^2) + \[Delta] h^3 q^2/((Bi h + K1)^3)
\[Omega] = \[Omega]3 /. {\[Epsilon] -> 6.01*10^-8, \[Delta] -> 
    5.19*10^-7, K1 -> 1, Bi -> 1, m -> 0.1092, Bo -> 0}

I vary the q via a table and capture the film thickness for omega=0 for

ListPlot[
 Table[
  q = qx;
  2.35 FindRoot[\[Omega] == 0, {h, 1}][[1]][[2]],
  {qx, 0.1, 2, 0.1}
  ],
 PlotRange -> {{0, 21}, {0.0, 4}},
 AxesLabel -> {"wavenumber", "Growth rate"},
 BaseStyle -> {FontSize -> 18},
 Frame -> {True, True, False, False},
 FrameLabel -> {"Wavenumber, q", 
   "\!\(\*SubscriptBox[\(h\), \(\[Omega] = 0\)]\)[mm]"},
 PlotStyle -> Directive[Thick, Black, PointSize[Large]]
 ]

The plot looks like this:

enter image description here

The x axis has grid points and not the values of q. Is there any way I could have q values instead of grid points?

share|improve this question
1  
Replace ; with , after assigning q and drop first list of PlotRange. –  BoLe May 10 '13 at 11:36
    
@BoLe Useful! Thanks! –  drN May 10 '13 at 14:35
add comment

2 Answers

up vote 2 down vote accepted

There are two ways.

The first way is to specify your data differently to get pairs of numbers like this:

datatoplot = Table[{qx,
   2.35 FindRoot[(\[Omega] /. q -> qx) == 0, {h, 1}][[1]][[2]]}, {qx, 
   0.1, 2, 0.1}]

ListPlot[datatoplot, PlotRange -> {{0, 2.5}, {0.0, 4}}, 
 AxesLabel -> {"wavenumber", "Growth rate"}, 
 BaseStyle -> {FontSize -> 18}, Frame -> {True, True, False, False}, 
 FrameLabel -> {"Wavenumber, q", 
   "\!\(\*SubscriptBox[\(h\), \(\[Omega] = 0\)]\)[mm]"}, 
 PlotStyle -> Directive[Thick, Black, PointSize[Large]]]

enter image description here

Alternatively, use the FrameTicks option to ListPlot to replace the tick label at each point.

ListPlot[datatoplot2, PlotRange -> {{0, 20}, {0.0, 4}}, 
 AxesLabel -> {"wavenumber", "Growth rate"}, 
 BaseStyle -> {FontSize -> 18}, Frame -> {True, True, False, False}, 
 FrameTicks -> {{Automatic, 
    None}, {Transpose[{Range[0, 20, 5], Range[0, 2, 0.5]}], None}}, 
 FrameLabel -> {"Wavenumber, q", 
   "\!\(\*SubscriptBox[\(h\), \(\[Omega] = 0\)]\)[mm]"}, 
 PlotStyle -> Directive[Thick, Black, PointSize[Large]]]

enter image description here

You can tweak the presentation according to taste. Have a look at some of the other questions about Ticks for some ideas.

share|improve this answer
    
This is rather interesting. I didn't think that "specifying my data differently" outside the plot function would help me... –  drN May 10 '13 at 14:27
add comment

I think the fastes way is not to change ticks but the argument of ListPlot to:

Table[
  {q = qx,
   2.35 FindRoot[\[Omega] == 0, {h, 1}][[1]][[2]]
  },
{qx, 0.1, 2, 0.1}
 ]

Edit: so like b.gatessucks said in comment while I was writing this post. :)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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