Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Seaborn: How to change linewidth and markersize separately in factorplot?

I understand that scale changes both parameters at the same time, but I want to achieve the effect of having a thin line connected between big markers.

I also tried resizing through rc{'lines.linewidth' = 1, 'lines.markersize' = 5}, but it ends up scaling both the markersize and linewidth together instead of setting them independently. Essentially, markersize has no effect for some reason.

Edit: Added plot and code to show the problem

import seaborn as sns                                                      

sns.set(style="whitegrid")                                                 
paper_rc = {'lines.linewidth': 1, 'lines.markersize': 10}                  
sns.set_context("paper", rc = paper_rc)                                    

# Load the example exercise dataset                                        
df = sns.load_dataset("exercise")                                          

# Draw a pointplot to show pulse as a function of three categorical         factors
g = sns.factorplot(x="time", y="pulse", hue="kind", col="diet", data=df,   
                       palette="YlGnBu_d", size=6, aspect=.75)         
g.despine(left=True)                                                       

The first two figures below are created with markersize 1 and 10, respectively. As shown, they appear to have the same markersize. The last figure uses line.linewidth=10 line.markersize=1, which enlarges both the linewidth and markersize.

Marker Size 1

Marker Size 10

Marker and line size 10

like image 354
kc2uno Avatar asked Apr 05 '16 03:04

kc2uno


1 Answers

you can import seaborn to get the pretty layout, and plot using matplotlib, to get easier/better config tools.

with matplotlib you can just make 2 plots on the same figure, a scatter plot (with markersize arbitrary) and a line plot with linewidth arbitrary as well

hope that helps

like image 99
epattaro Avatar answered Sep 19 '22 21:09

epattaro