geospatial-python icon indicating copy to clipboard operation
geospatial-python copied to clipboard

Improve aesthetics of geospatial plots, particularly axis ticks

Open rbavery opened this issue 5 years ago • 4 comments

12-phenology-with-points-plot-03

It'd be great if by default geospatial plots did not truncate axis ticks.

In the meantime, there is an easy one liner to change a setting to display axis ticks without truncation: plt.ticklabel_format(style="plain")

I only found out about this later on when developing the lesson, so maybe this line should lead each episode, or the first episode, to ensure that learner's plots look cleaner from the start.

rbavery avatar Oct 23 '20 20:10 rbavery

@rbavery, I'm testing this locally and the plt.ticklabel_format(style="plain") line must be called for each plot, i.e. it does not work if I run it on the first cell of a notebook and then create the plot on a different cell. Is this the same for you?

I'm trying to think if there's a way to set this using Matplotlib's rcParams.

vinisalazar avatar Apr 15 '21 22:04 vinisalazar

I'll check this out later while working on some new episodes, thanks @vinisalazar

rbavery avatar Apr 21 '21 00:04 rbavery

@rbavery How about using the axes.formatter.limits rcParam? Setting the upper bound to 7 forces the truncated UTM coordinates to print as plain numbers.

# Force large numbers in tick labels to print in full
mpl.rcParams["axes.formatter.limits"] = -5, 7

adamancer avatar Nov 02 '21 14:11 adamancer

Thanks for the tip @adamancer looks helpful! I think that'll work

rbavery avatar Nov 02 '21 14:11 rbavery