Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. #Multiple Scatter Plots
  2. from plotly import tools
  3. trace1 = go.Scatter(x=df_sts.MedianListingPrice_1Bedroom,
  4. y=df_sts.MedianListingPrice_2Bedroom, mode='markers',
  5. name = "1Bedroom&2Bedroom", marker = dict(
  6. color = 'rgb(102,255,255)'))
  7. trace2 = go.Scatter(x=df_sts.MedianListingPrice_2Bedroom,
  8. y=df_sts.MedianListingPrice_3Bedroom, mode='markers',
  9. name = "2Bedroom&3Bedroom", marker = dict(
  10. color = 'rgb(102,178,255)'))
  11. trace3 = go.Scatter( x=df_sts.MedianListingPrice_3Bedroom,
  12. y=df_sts.MedianListingPrice_4Bedroom, mode='markers',
  13. name = "3Bedroom&4Bedroom", marker = dict(
  14. color = 'rgb(102,102,255)'))
  15. trace4 = go.Scatter(x=df_sts.MedianListingPrice_4Bedroom,
  16. y=df_sts.MedianListingPrice_5BedroomOrMore, mode='markers',
  17. name = "4Bedroom&5+Bedroom", marker = dict(
  18. color = 'rgb(178, 102, 255)'))
  19.  
  20. fig = tools.make_subplots(rows=2, cols=2, subplot_titles=("1Bedroom & 2Bedroom", "2Bedroom & 3Bedroom",
  21. "3Bedroom&4Bedroom", "4Bedroom&5+Bedroom"))
  22.  
  23. fig.append_trace(trace1, 1, 1)
  24. fig.append_trace(trace2, 1, 2)
  25. fig.append_trace(trace3, 2, 1)
  26. fig.append_trace(trace4, 2, 2)
  27.  
  28. fig['layout']['xaxis3'].update(title='Median Listing Price')#showgrid=False
  29. fig['layout']['xaxis4'].update(title='Median Listing Price')
  30.  
  31. fig['layout']['yaxis1'].update(title='Median Listing Price')
  32. fig['layout']['yaxis3'].update(title='Median Listing Price')
  33.  
  34. fig['layout'].update(height=600, width=600, title='Mutiple Scatter Plots: Median Listing Price of' +
  35. ' Bedrooms')
  36. url = py.plot(fig, validate=False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement