restdollar.blogg.se

Matplotlib annotate text
Matplotlib annotate text








matplotlib annotate text

Copy it to the clipboard and read in with df = pd.read_clipboard(sep=',') or create a file and read with pd.read_csv. # iterate through each axes of the figure-level plot Using a seaborn figure-level plot g = sns.relplot(x='total_votes', y='dem_share', data=swing, hue='state', height=10) Using a seaborn axes-level plot with the object oriented api fig, ax = plt.subplots(figsize=(10, 10)) Perhaps there was a bug at the time, but the MRE from the OP, works without issue.

matplotlib annotate text

annotate with weight='bold' plt.annotate('small counties most vote for McCain', xy=(50000, 20), weight='bold', annotate without bold plt.annotate('12 largest counties most vote for Obama', xy=(650000, 52), Sns.scatterplot(x='total_votes', y='dem_share', data=swing, hue='state') Imports, DataFrame & Plot Setup import pandas as pd In this case, use the LaTex syntax \textbf')) Note: If LaTex fonts, plt.rc('text', usetex=True), are used, weight='bold' may have no effect.

matplotlib annotate text

  • Use the weight or fontweight parameter.
  • For seaborn figure-level plots, you must iterate through each axes, which isn't shown.
  • Adding annotations / text also works in seaborn axes-level plots with the same methods.









  • Matplotlib annotate text