1
$\begingroup$

I have the following example code that produces a contour plot with logarithmic scales. I now want to rotate the x-axis labels, since they are overlapping. I found a solution on the internet, but it does not work in my case. I guess it's due to the logarithmic scale?

customTicks = 
  Table[{i, Rotate[i, Pi/4]}, {i, {1.*^-5, 5.*^-5, 1.*^-4}}];

ContourPlot[m^2*g^3, {m, 10^(-5), 1*10^(-4)}, {g, 0.01, 0.04}, 
 ScalingFunctions -> {"Log", "Log"}, 
 PlotLegends -> 
  BarLegend[{Automatic, Automatic}, 
   LegendLabel -> 
    "\!\(\*SubscriptBox[\(Log\), \
\(10\)]\)|\!\(\*SuperscriptBox[SubscriptBox[OverscriptBox[\(E\), \
\(^\)], \(2\)], \
\(++\)]\)|[\!\(\*SuperscriptBox[SubscriptBox[OverscriptBox[\(a\), \(^\
\)], \(0\)], \(-+\)]\)]", LabelStyle -> {FontSize -> 18}], 
 PlotPoints -> 15, PlotRange -> All, Contours -> 10, Frame -> True, 
 FrameLabel -> {Style["m", 24], Style["g", 24]}, 
 FrameTicksStyle -> Directive[FontSize -> 18], 
 RegionFunction -> 
  Function[{m, g, z}, g <= omV/B0V*nV*10^9*Sqrt[1 - m^2]], 
 Ticks -> {customTicks, Automatic}]

The produced figure looks as follows:

enter image description here

$\endgroup$
3
$\begingroup$

Use the option FrameTicks instead of Ticks:

ContourPlot[m^2*g^3, {m, 10^(-5), 1*10^(-4)}, {g, 0.01, 0.04}, 
 ScalingFunctions -> {"Log", "Log"}, PlotPoints -> 15, 
 PlotRange -> All, Contours -> 10, Frame -> True, 
 FrameLabel -> {Style["m", 24], Style["g", 24]}, 
 FrameTicksStyle -> Directive[FontSize -> 18], 
 FrameTicks -> {{Automatic, Automatic}, {customTicks, Automatic}}]

enter image description here

|improve this answer|||||
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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