brights.append(bright) lons.append(lon) lats.append(lat) hover_texts.append(hover_texts) print(brights[:10]) from plotly.graph_objs import Scattergeo, Layout from plotly import offline as go data = [{ 'type': 'scattergeo', 'lon': lons, 'lat': lats, 'marker': { 'size': [.04 * bright for bright in brights], 'color': brights, 'colorscale': 'Viridis', 'reversescale': True, 'colorbar': { 'title': 'Brightness' } }, }] my_layout = Layout(title="Australian Fires- January 2020") fig = {'data': data, 'layout': my_layout} go.plot(fig, filename='aussie_firesJAN.html')
brights.append(bright) lons.append(lon) lats.append(lat) hover_texts.append(hover_texts) print(brights[:10]) from plotly.graph_objs import Scattergeo, Layout from plotly import offline as go data = [{ 'type': 'scattergeo', 'lon': lons, 'lat': lats, 'marker': { 'size': [.04 * bright for bright in brights], 'color': brights, 'colorscale': 'Viridis', 'reversescale': True, 'colorbar': { 'title': 'Brightness' } }, }] my_layout = Layout(title="Australian Fires- November 2019") fig = {'data': data, 'layout': my_layout} go.plot(fig, filename='aussie_firesNOV.html')
####### # Objective: Create a bubble chart that compares three other features # from the mpg.csv dataset. Fields include: 'mpg', 'cylinders', 'displacement' # 'horsepower', 'weight', 'acceleration', 'model_year', 'origin', 'name' ####### # Perform imports here import pandas as pd import plotly.offline as go import plotly.graph_objs as pyo # Create a DataFrame from the .csv file: df = pd.read_csv('../data/mpg.csv') # Create data by choosing fields for x, y and marker size attributes data = go.Scatter(x=df['displacement'], y=df['acceleration'], text=df['name'], mode='markers', marker=dict(size=df['weight'] / 400)) # Create a Layout with a title and axis labels layout = go.Layout(title='My Bubble Solution', hovermode='closest') figure = go.Figure(data=data, layout=layout) pyo.plot(figure, filename='bubble-chart-exercise.html') # Create
mags.append(mag) lons.append(lon) lats.append(lat) hover_texts.append(hover_texts) print(mags[:10]) from plotly.graph_objs import Scattergeo, Layout from plotly import offline as go data = [{ 'type': 'scattergeo', 'lon': lons, 'lat': lats, 'marker': { 'size': [5 * mag for mag in mags], 'color': mags, 'colorscale': 'Viridis', 'reversescale': True, 'colorbar': { 'title': 'Magnitude' } }, }] my_layout = Layout(title="Global Earthquakes") fig = {'data': data, 'layout': my_layout} go.plot(fig, filename='global_earthquakes.html')