Skip to content
Advertisement

Seaborn plot displot with hue and dual y-scale (twinx)

I am trying to plot the output from the predict of a ML model, there are the classes 1,0 for the Target, and the Score. Due the dataset is not balanced, there are few 1’s.

When I plot a simple displot with the Target in the hue parameter, the plot is useless for describing the 1’s

JavaScript

enter image description here

I want to change the scale for the 1’s in the same plot, with a second y-scale in the right with twinx.

I have tried the following codes that may solve the problem with 2 plots, but I need only one plot. I couldn’t use twinx.

JavaScript

enter image description here

JavaScript

enter image description here

A reproducible example could be with the titanic dataset:

JavaScript

enter image description here

JavaScript

enter image description here

Advertisement

Answer

I am not sure but are you looking for this.

JavaScript

Plot

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement