has2k1 / plotnine

A Grammar of Graphics for Python
https://plotnine.org
MIT License
4.07k stars 225 forks source link

geom_errror `size` working like `alpha` #559

Closed NataliaDelCoco closed 2 years ago

NataliaDelCoco commented 2 years ago

Hi! When using geom_error or geom_errorh from plotnine version 0.7.1, I understood the attribute size should change the error bar hat size (default = 0.5). Instead, it works like alpha attributive.

The code with size = 0.1

g = (ggplot(df_sil_cluster_no_out) + 
     geom_point(aes(x='len_mean', y='sil_mean', fill = 'status'),size=5,alpha = 0.8) + 
     geom_errorbarh(aes(y = "sil_mean", xmin = "len_mean-len_std", xmax = "len_mean+len_std"),
                    size=0.1)
)

results in:

image

Now, with size = 1: image

The alpha attribute works as expected.

has2k1 commented 2 years ago

The size=0.1 of lines is too small and the image is rasterized so that is probably antialiasing gone wrong. If you save the plot in a vector format like pdf, you should get better results. Or you could increase the dpi so some large value e.g. + theme(dpi=300), though I rarely find it helpful to mess with the dpi.