I'm using Python's plotnine
package to plot some grouped data, similarly as one would do in R's ggplot2
package. So far, I'm grouping by color and shape. Now, I want to additionally plot filled vs. unfilled shapes/markers. Since
What I want is that all markers from Method 1 are filled (as they are now) while all markers from Method 2 are unfilled (or striped or s.th. else). Everything else should stay as it is. Somehow I don't manage to get there...
Any help is highly appreciated!
CodePudding user response:
There is a workround if you want to get unfilled markers for Methed 2. Just add a fill
mapping and specify the fill color of Method 2 to be transparent (set alpha to zero by using RGBA string).
(
ggplot(df, aes(x = 'value_1', y = 'value_2', shape = 'Group',color='Method', fill='Method')) # Add fill mapping
geom_point(size = 5, alpha = 0.75)
scale_x_continuous(name = 'Value 1')
scale_y_continuous(name = 'Value 2')
scale_fill_manual(values = ['blue', '#ffffff00'] * 3) # Add this
scale_color_manual(values = ['blue', 'green'] * 3)
facet_grid('~Data')
theme_bw()
theme(axis_title_x = element_text(size = 12),
axis_text_x = element_text(size = 10, angle = 45),
axis_title_y = element_text(size = 12),
axis_text_y = element_text(size = 10),
strip_text_x = element_text(size = 10),
legend_title = element_text(size = 12),
legend_text = element_text(size = 10))
)
This is the obtained figure: