![]() format ( title = 'ProPlot formatter' ) axs. format ( xformatter = 'scalar', yformatter = 'scalar', title = 'Matplotlib formatter' ) axs. ![]() format ( ytickloc = 'both', yticklabelloc = 'both', titlepad = '0.5em', suptitle = 'Default formatters demo' ) # Formatter comparison locator = axs. subplots ( ncols = 2, nrows = 2, refwidth = 1.5, share = False ) axs. gridwidth = 1 # Create the figure fig, axs = pplt. ![]() This class trims trailing zeros byĭefault, can be used to omit tick labels outside of some data range, andĬan add arbitrary prefixes and suffixes to each label. ProPlot also changes the default tick formatter toĪutoFormatter. They are also imported into the top-level namespace If you want to work directly with the formatter classes, New tick formatters – for example, xformatter='deglat' to label ticksĪs geographic latitude coordinates, xformatter='pi' to label ticks asįractions of \(\pi\), or xformatter='sci' to label ticks with Like set_xticklabels) You can also apply one of ProPlot’s To apply custom tick labels with FixedFormatter (just (e.g., xformatter='log'), to apply a %-style format directive withįormatStrFormatter (e.g., xformatter='%.0f'), or This is powered by the Formatter constructor function. In ProPlot, you canĬhange the tick formatter using the format keywordĪrguments xformatter and yformatter (or their aliases, xticklabels and reset ()Ĭonvert floating point numbers to nicely-formatted tick labels. format ( xlim = ( 0, 2 ), xlocator = 'dms', xformatter = 'dms', title = 'Degree-Minute-Second Locator (requires cartopy)', ) pplt. format ( xlim = ( - 10, 10 ), xlocator = 'null', title = 'NullLocator', ) # Tick locations that cleanly divide 60 minute/60 second intervals ax = fig. format ( xlim = ( 1, 7 ), xlocator = ( 'maxn', 11 ), title = 'MaxNLocator', ) # Hide all ticks ax = fig. format ( xlim = ( 1, 100 ), xlocator = 'log', xminorlocator = 'logminor', title = 'LogLocator', ) # Maximum number of ticks, but at "nice" locations ax = fig. format ( xlim = ( 0, 10 ), xlocator = ( 'linear', 21 ), title = 'LinearLocator', ) # Logarithmic locator, used automatically for log scale plots ax = fig. format ( xlim = ( 0, 10 ), xminorlocator = 0.1, xlocator =, title = 'FixedLocator', ) # Ticks at numpy.linspace(xmin, xmax, N) ax = fig. format ( xlim = ( 0, 200 ), xminorlocator = 10, xlocator = 30, title = 'MultipleLocator' ) # Specific list of locations ax = fig. format ( suptitle = 'Tick locators demo' ) # Step size for tick locations ax = fig. figure ( share = False, refwidth = 5, refaspect = ( 8, 1 )) fig. scale_luminance ( 'powderblue', 1.15 ), ) fig = pplt. update ( metawidth = 1, fontsize = 10, metacolor = 'dark blue', suptitlecolor = 'dark blue', titleloc = 'upper center', titlecolor = 'dark blue', titleborder = False, axesfacecolor = pplt. Import proplot as pplt import numpy as np state = np. Version of numpy.arange, which is usually what you’ll want in this context. To generate lists of tick locations, we recommend using ProPlot’sĪrange function – it’s basically an endpoint-inclusive Into the top-level namespace (e.g., pplt.MultipleLocator(5) is allowed). If you want to work directly with the locator classes, they are also imported Specific locations in a list using FixedLocator (just MultipleLocator (e.g., xlocator=2), or to tick the (e.g., xlocator='log'), to draw ticks every N data values with ![]() You can use these keyword arguments to apply built-in matplotlib In ProPlot, you canĬhange the tick locator using the format keywordĪrguments xlocator, ylocator, xminorlocator, and yminorlocator (or theirĪliases, xticks, yticks, xminorticks, and yminorticks). Select sensible tick locations based on the axis data limits. It also documents a handy “dual units” feature. This section documents features used for modifying Cartesian x and yĪxis settings, including axis scales, tick locations, and tick labelįormatting.
0 Comments
Leave a Reply. |