JuliaPlots / Plots.jl

Powerful convenience for Julia visualizations and data analysis
https://docs.juliaplots.org
Other
1.84k stars 354 forks source link

[FR] abc option #3172

Open isentropic opened 3 years ago

isentropic commented 3 years ago

From https://proplot.readthedocs.io/en/latest/basics.html

 _images/basics_6_1.svg

# Really complex grid
import proplot as plot
array = [  # the "picture" (1 == subplot A, 2 == subplot B, etc.)
    [1, 1, 2],
    [1, 1, 6],
    [3, 4, 4],
    [3, 5, 5],
]
fig, axs = plot.subplots(array, width=5, span=False)
axs.format(
    suptitle='Really complex subplot grid',
    xlabel='xlabel', ylabel='ylabel', abc=True
)
axs[0].plot(data, lw=2)

image

We could also have abc=true option to insert a b c labels for each subplot. I feel this would be very useful for publishing

mkborregaard commented 3 years ago

Maybe title = :auto is more consistent with the existing interface?

isentropic commented 3 years ago

In proplot, these letters are not titles, they are like annotations at the corners, titles are still free to the user. But perhaps for simplicity, we can restrict it to titles with right or left alignment. This way positioning across backends would be easier.

image

isentropic commented 3 years ago

So for example they have

axs.format(
    suptitle='Format command demo',
    abc=True, abcloc='ul', abcstyle='A.',
    title='Main', ltitle='Left', rtitle='Right',  # different titles
    urtitle='Title A', lltitle='Title B', lrtitle='Title C',  # extra titles
    collabels=['Column label 1', 'Column label 2'],
    rowlabels=['Row label 1', 'Row label 2'],
    xlabel='x-axis', ylabel='y-axis',
    xscale='log',
    xlim=(1, 10), xticks=1,
    ylim=(-3, 3), yticks=plot.arange(-3, 3),
    yticklabels=('a', 'bb', 'c', 'dd', 'e', 'ff', 'g'),
    ytickloc='both', yticklabelloc='both',
    xtickdir='inout', xtickminor=False, ygridminor=True,
)

image