Black Lives Matter. Please consider donating to Black Girls Code today.

Clarification on marker+dots line graph

Hi,

I am new to plotly.I tried implementing line chart ans its working.I need to get marker on both lines but marker is displaying on one line and another one showing just line without marker.I tested with my data it is working with minimum data set .I am stucked on this this.Can anyone help me to solve this?I missed anything here!This is my code and attached my output.I need to get marker on both lines.

import plotly.graph_objs as go
import dash
import dash_core_components as dcc
import dash_html_components as html



external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
 
 
layout = go.Layout(
 title="Report"
 ,xaxis_type="log"
 , yaxis_type="log"
 , yaxis=dict(
	 autorange=True
	 , showgrid=False
	 , zeroline=False
	 , showline=False
	 , showticklabels=False
 )
)

app.layout = html.Div([
 dcc.Graph(
	 figure=dict(
		 data=[
			 dict(
				 x=['0.0', '0.1', '0.4', '0.7', '1.0', '2.0', '3.0', '4.0', '5.0', '6.0', '7.0', '8.0', '9.0', '10.0', '13.0', '16.0', '19.0', '22.0', '25.0', '30.0', '35.0', '40.0', '45.0', '50.0', '55.0', '60.0', '65.0', '70.0', '75.0', '80.0', '85.0', '90.0', '95.0'],
				 y=['1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2', '1.2'],
				 name='Fixed',
				 marker=dict(
					 color='rgb(55, 83, 109)'
				 )
			 ),
			 dict(
				 x=['0.0', '1.0', '4.0', '7.0', '10.0', '18.0', '25.0', '45.0', '65.0', '85.0'],
				 y=['1', '1', '1', '1', '1', '1', '1', '1', '1', '1'],
				 name='Unfixed',
				 marker=dict(
					 color='rgb(26, 118, 255)'
				 )
			 )
		 ],
		 layout=layout
	 ),
	 style={'height': 300},
	 id='my-graph'
 )

])
if __name__ == '__main__':
   app.run_server(debug=True)

Hi @anandmk, welcome to the forum! You need to pass mode='lines+markers' to display the two. See for example https://plot.ly/python/line-and-scatter/ , in particular https://plot.ly/python/line-and-scatter/#line-and-scatter-plots.

1 Like

Thanks a lot @Emmanuelle It worked for me!