I'm trying to plot a ROC curve using seaborn (python). With matplotlib I simply use the function plot
:
plt.plot(one_minus_specificity, sensitivity, 'bs--')
where one_minus_specificity
and sensitivity
are two lists of paired values.
Is there a simple counterparts of the plot function in seaborn? I had a look at the gallery but I didn't find any straightforward method.
Using size parameter to plot multiple line plots in Seaborn. We can even use the size parameter of seaborn. lineplot() function to represent the multi data variable relationships with a varying size of line to be plotted. So it acts as a grouping variable with different size/width according to the magnitude of the data ...
You probably need to re-organize your dataframe in a suitable way so that there is one column for the x data, one for the y data, and one which holds the label for the data point. You can also just use matplotlib. pyplot . If you import seaborn , much of the improved design is also used for "regular" matplotlib plots.
To plot a line plot in Matplotlib, you use the generic plot() function from the PyPlot instance. There's no specific lineplot() function - the generic one automatically plots using lines or markers. This results in much the same line plot as before, as the values of x are inferred.
Since seaborn also uses matplotlib to do its plotting you can easily combine the two. If you only want to adopt the styling of seaborn the set_style
function should get you started:
import matplotlib.pyplot as plt import numpy as np import seaborn as sns sns.set_style("darkgrid") plt.plot(np.cumsum(np.random.randn(1000,1))) plt.show()
Result:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With