Axis Tick Direction

If the axis_ticks_length, axis_ticks_length_x, or axis_ticks_length_y parameter in theme() is set to a negative value, the ticks are drawn inward, pointing toward the plot area.

In [1]:
import pandas as pd
from datetime import datetime
from lets_plot import *
In [2]:
LetsPlot.setup_html()
In [3]:
economics_url = 'https://raw.githubusercontent.com/JetBrains/lets-plot-docs/master/data/economics.csv'
economics = pd.read_csv(economics_url)
economics['date'] = pd.to_datetime(economics['date'])
start = datetime(2000, 1, 1)
economics = economics.loc[economics['date'] >= start]
In [4]:
# Base plot

p_dt = ggplot(economics, aes('date', 'unemploy')) + \
    geom_line() + \
    theme_classic() + \
    theme(panel_inset=[0,10,0,0]) + \
    ggsize(600, 300)
p_dt
Out[4]:
In [5]:
# To make the ticks more visible while keeping a compact layout, you can direct them inward.

p_dt + theme(axis_ticks_length=-8)
Out[5]:
In [6]:
# You can control the tick length separately for each axis.

p_dt + theme(axis_ticks_length_x=-6, axis_ticks_length_y=4)
Out[6]: