AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Seaborn scatter plot marker size8/8/2023 More hopefully, there is a way to do it and they will simply point out how. You can submit an issue to the seaborn repository and maybe they will fix it (you can give a reference to your question). tonumpy () s 3 s 2 for s in size fig, ax plt.subplots (figsize ( 10, 6 )) ax.scatter (x df 'GDP per capita', y df 'Generosity', s s) plt.xlabel ( 'GDP per Capita' ) plt.ylabel ( 'Generosity Score' ). So, altering the legend afterwards messes things up.įrom my research, it looks like there's no simple way to do what you want. import matplotlib.pyplot as plt import pandas as pd df pd.readcsv ( 'worldHappiness2019.csv' ) size df 'Score'. points pl.scatter ( ' 2017 ', marker ' square ', color randcolor. From a quick glance, I think it happens because FacetGrid calculates its size using the legend dimensions. Define the number of elements to plot 13. resolution adjusting 32 S scatter plot about 10 creating, in Seaborn 134. This method, however, severely messes up with the formatting. visuals color 242 hue 242 minimal marker shapes 242 size 242 spacing 242. Plt.setp(g._legend.get_texts(), fontsize=16) It uses the private property _legend of the FacetGrid and increase the text size directly: g = sns.relplot(x='sepal_length', y='sepal_width', hue='species', data=iris) In the mentioned SO link, there's also an answer that addresses directly modifying the legend. So, for example, axis labels will grow alongside the legend: Scatter plot with variable marker size (seaborn) 26. How can I increase the thickness of this marker. I am using the vline marker '' for this scatterplot. The problem with both approaches is that they also increase the size of other elements. I am generating a KDE plot and adding the data points as a scatter plot as well. With sns.plotting_context("notebook", font_scale=1.5):
0 Comments
Read More
Leave a Reply. |