plotly - changing the line styles
<p>I am trying to plot multiple yet related things on a plotly graph. </p>

<p>I want to differentiate and relate the lines at the same time. To make myself more clearer, I am plotting ROC characteristics of the classifiers that I trained. I want a particular classifier of the same color but different line styles for the method of training.</p>

<p>I currently use this to fulfill my requirement:
<a href="http://i.stack.imgur.com/yqGq9.png" rel="nofollow"><img src="http://i.stack.imgur.com/yqGq9.png" alt="enter image description here"></a></p>

<p>Here is the code for the same,</p>

<pre><code>    data = [
        go.Scatter(
            mode='lines+markers',
            x=df_LogisticRegression['FPR'], # assign x as the dataframe column 'x'
            y=df_LogisticRegression['TPR'],
            name = "Logistic Regression all attributes",
            marker=dict(
                color="blue",
                symbol='square'
            ),
        ),
        # and so on for all other algos
        go.Scatter(
            mode='lines+markers',
            x=df_LogisticRegression_nonSP['FPR'], # assign x as the dataframe column 'x'
            y=df_LogisticRegression_nonSP['TPR'],
            name = "Logistic Regression non-sparse attributes",
            marker=dict(
                color="blue",
                symbol='square-open'
            ),
        ),
         # and so on for all other algos
    ]
layout = go.Layout(
    title='ROC Curve',
    yaxis=dict(title='True Positive Rates(TPR)'),
    xaxis=dict(title='False Positive Rates(FPR)')
)
fig = go.Figure(data=data,layout=layout)
iplot(fig)
</code></pre>

<p>For instance,
I am looking to have the color of logistic regression as blue, but the one with "all attributes should be a solid line and the one with "non-sparse attributes" should be broken lines.</p>

<p>I tried to look up and read up the documentation for plotly but could not find anything help.</p>

<p>It is because the plotly, plots the data based on the mode which you ask it to do. If you say <code>mode=markers</code> it is going to plot just the markers. If you say <code>mode=lines</code> it is going the join all the points in the data and plot it as lines.</p>

<p>Please see this page <a href="https://plot.ly/python/line-and-scatter/#line-and-scatter-plots" rel="nofollow">https://plot.ly/python/line-and-scatter/#line-and-scatter-plots</a> for more examples of lines that can be plotted using plotly. </p>

python plot plotly roc