Closed mjko1210 closed 4 years ago
Yes, this is possible by editing the individual axes. There is a function in matplotlib called ax.grid
that will add gridlines to an axis object. By default this grid doesn't line up with the comut's patches, so you'll need to do some tinkering. Let's say I wanted to add such a grid to a categorical dataset named 'Mutation type'
from matplotlib.ticker import AutoMinorLocator # this function sets the location of the minor tick mark
minor_locator = AutoMinorLocator(2) # will place minor ticks in between major ticks
# set the axis minor tick locations to these positions
comut.axes['Mutation type'].yaxis.set_minor_locator(minor_locator)
comut.axes['Mutation type'].xaxis.set_minor_locator(minor_locator)
# add the grid
comut.axes['Mutation type'].grid(which='minor', color='black')
# the spines by default are off, so we need to add them back
comut.axes['Mutation type'].spines['left'].set_visible(True)
comut.axes['Mutation type'].spines['bottom'].set_visible(True)
The process is exactly the same for continuous data
Hi,
Is it possible to add grid to plots generated by
add_continuous_data
andadd_continuous_data
.For example, I want to add grey grid lines like this plot.
Thanks for your advice!