Home > Mobile >  Logarithmic Ticks on Top and Right Spine
Logarithmic Ticks on Top and Right Spine

Time:09-27

I am trying to make a visualization with logarithmic ticks on all sides of the box.

import numpy as np
import matplotlib.pyplot as plt

x  = np.logspace(2, 5, 5)
y  = 0.5*x**(-1/2)
y2 = 0.01*x**(-1/2)
y3 = 0.05*x**(-1/3)

fig, ax = plt.subplots()

ax.plot(x, y, 'o-', label="One")
ax.plot(x, y2, '*-', label="Two")
ax.plot(x, y3, '--', label="Three")

ax.set(
    
    xlabel='Input',
    xlim=(1e2, 1e5),
    xscale='log',
    
    ylabel='Output',
    ylim=(1e-5, 1e-1), 
    yscale='log',   
)

ax.tick_params(top=True, right=True) # <-- This didn't work how I expected.

ax.legend(loc='lower left');

loglogfigure

I would like the associated minor tick marks on the top and right spine.

Any advice on how to make that happen?

CodePudding user response:

Use the which parameter of enter image description here

  • Related