0

I have 2 vectors of data x_replaced and FoM to plot as (x,y). To plot it, here what I have done :

import os, sys
import numpy as np
import matplotlib.pyplot as plt

# Plotting FoM vs prior
fig, axes = plt.subplots()
axes.set_xscale("log")

for j in range(5):
  x_replaced = 1./np.sqrt(prior_total[:,j])
  axes.plot(x_replaced, FoM_final)

from matplotlib.ticker import ScalarFormatter
axes.get_xaxis().set_major_formatter(ScalarFormatter())

plt.xlabel(r'Prior '+r'$\Delta(\sigma)$'+' on 5'+r'$b_{sp}$'+' in Fisher GCsp + 3x2pt', fontsize=10)
plt.ylabel('FoM')
plt.tight_layout()
plt.savefig('output.pdf')

and below the result :

overlapping values with logspace on x-axis

As you can see, values on x-axis are overlapping and I don't know how to debug this.

Maybe a solution would be to make rotate the x-axis values ?

If anyone could see how to circumvent this problem at first sight ?

youpilat13
  • 83
  • 5
  • 29
  • 89
  • You seem to be only setting the major formatter. Log plots also have minor ticks (a bit shorter to indicate intermediate positions and creating the typical logscale look). The minor ticks are disturbing you (in general not all minor ticks have labels, I don't know the details). – JohanC Feb 08 '21 at 18:21
  • [Overlapping axis tick labels in logarithmic plots](https://stackoverflow.com/questions/44323626/setting-xticks-with-log-scale-results-in-some-overlapping-labels) suggests to leave out `set_xscale("log")` as the distances on the axes aren't very log like. – JohanC Feb 08 '21 at 18:35

0 Answers0