Skip to content

Text mark#3051

Merged
mwaskom merged 12 commits intomasterfrom
mark/text
Oct 4, 2022
Merged

Text mark#3051
mwaskom merged 12 commits intomasterfrom
mark/text

Conversation

@mwaskom
Copy link
Copy Markdown
Owner

@mwaskom mwaskom commented Sep 30, 2022

A new mark that shows text at x/y locations, with various other properties:

(
    so.Plot(glue, "Average", "Model", text="Average")
    .add(so.Bar())
    .add(so.Text(halign="right", color="w"))
)

Current properties:

Init signature:
so.Text(
    artist_kws: 'dict' = <factory>,
    text: 'MappableString' = <''>,
    color: 'MappableColor' = <'k'>,
    alpha: 'MappableFloat' = <1>,
    fontsize: 'MappableFloat' = <rc:font.size>,
    halign: 'MappableString' = <'center'>,
    valign: 'MappableString' = <'center_baseline'>,
    offset: 'MappableFloat' = <4>,
) -> None

Note: this is somewhat limited in usefulness at the moment due to #3053; it's not possible to annotate using the result of a statistical transform. But that needs an upstream solution, I think.

To do:

  • Docstring w/ examples
  • Documentation of new properties
  • Unit tests
  • Decide on whether we'll have a formatting property (no, at least for now)
  • Allow marks to not have a legend artist

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 30, 2022

Codecov Report

Merging #3051 (36a2091) into master (ad11bdc) will increase coverage by 0.06%.
The diff coverage is 100.00%.

❗ Current head 36a2091 differs from pull request most recent head 3ea116e. Consider uploading reports for the commit 3ea116e to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3051      +/-   ##
==========================================
+ Coverage   98.30%   98.36%   +0.06%     
==========================================
  Files          69       72       +3     
  Lines       23281    23453     +172     
==========================================
+ Hits        22886    23070     +184     
+ Misses        395      383      -12     
Impacted Files Coverage Δ
seaborn/_core/plot.py 99.18% <100.00%> (+<0.01%) ⬆️
seaborn/_core/properties.py 99.19% <100.00%> (+0.04%) ⬆️
seaborn/_marks/base.py 98.40% <100.00%> (+0.01%) ⬆️
seaborn/_marks/text.py 100.00% <100.00%> (ø)
seaborn/objects.py 100.00% <100.00%> (+100.00%) ⬆️
tests/_core/test_plot.py 98.63% <100.00%> (+<0.01%) ⬆️
tests/_marks/test_text.py 100.00% <100.00%> (ø)
tests/test_objects.py 100.00% <100.00%> (ø)

@mwaskom mwaskom changed the title POC: Text mark Text mark Oct 3, 2022
@mwaskom mwaskom added this to the v0.12.1 milestone Oct 3, 2022
@mwaskom mwaskom merged commit 63186a4 into master Oct 4, 2022
@mwaskom mwaskom deleted the mark/text branch October 4, 2022 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant