Changing the color of an axis

When using figures, you can easily change the spine color with: ax.spines[‘bottom’].set_color(‘#dddddd’) ax.spines[‘top’].set_color(‘#dddddd’) ax.spines[‘right’].set_color(‘red’) ax.spines[‘left’].set_color(‘red’) Use the following to change only the ticks: which=”both” changes both the major and minor tick colors ax.tick_params(axis=”x”, colors=”red”) ax.tick_params(axis=”y”, colors=”red”) And the following to change only the label: ax.yaxis.label.set_color(‘red’) ax.xaxis.label.set_color(‘red’) And finally the title: ax.title.set_color(‘red’)

Aligning y-ticks to the left

Tested in python 3.11.2, matplotlib 3.7.1 You will just need to add a pad. See matplotlib ticks position relative to axis yax = ax.get_yaxis() yax.set_tick_params(pad=pad) matplotlib.axis.Axis.set_tick_params To do your figuring of what the pad should be: import numpy as np import matplotlib.pyplot as plt ticks = [‘Lorem ipsum dolor sit amet, consectetur adipisicin’, ‘g elit, … Read more

matlab multiple x axis one below another

Here is an example solution if you only need a second axis for showing a different scale (Jeff_K’s solution but more worked out): first_axis = gca; sqz = 0.12; %// distance to squeeze the first plot set(first_axis, ‘Position’, get(first_axis, ‘Position’) + [0 sqz 0 -sqz ]); ax2 = axes(‘Position’, get(first_axis, ‘Position’) .* [1 1 1 … Read more