1

I am plotting large figures and the ticks on the X axes (horizontal) are colliding since there are many trailing zeros from numbers like "1000000" and then directly after the number "2000000".

As an example, I using this code:

lhs[x_, y_] := x^2+y^2
rhs[y_] := 1000^2

s1=1000;
ticks1 = Table[{Sign[i] Sqrt[Abs[i]], i}, {i, -s1, s1, 150}];

s2 = 1000;
ticks2 = Table[{Sign[i] Sqrt[Abs[i]], i}, {i, -s2, s2, 150}];

a=35;
ContourPlot[lhs[Sign[x] x^2, Sign[y] y^2] == rhs[Sign[y] y^2], 
  {x, -a, a}, {y, -a, a}, FrameTicks -> {{ticks1,None},{ticks2,None}}]

Which generates this image:

enter image description here

As you can see, the bottom ticks are all merged together.

Is there a way to make it look a bit nicer, either by rotating by 90 degrees the ticks on the bottom axes so they go "down" instead of "across" or better yet representing the ticks in scientific notation?

Gr Eg
  • 117
  • 6

1 Answers1

3
ContourPlot[
 lhs[Sign[x] x^2, Sign[y] y^2] == rhs[Sign[y] y^2], {x, -a, a}, {y, -a, a},
 FrameTicks :> {{ticks1, None}, {ticks2 /. {a_, b_} :> {a, Rotate[b, Pi/2]}, None}}]

enter image description here

Further options and demo for ScientificForm (don't forget the N!)

ContourPlot[
 lhs[Sign[x] x^2, Sign[y] y^2] == rhs[Sign[y] y^2], {x, -a, a}, {y, -a, a},
   FrameTicks :> {{ticks1, None}, {ticks2[[;; ;; 2]] /. {a_, b_} :> 
     {a, Rotate[ScientificForm[N @ b], Pi/4]}, None}}]

enter image description here

eldo
  • 67,911
  • 5
  • 60
  • 168