def create_wind_speed_daily(df): fig = make_subplots(rows=1, cols=2, specs=[[{'type': 'polar'}, {'type': 'xy'}]]) fig.add_trace(go.Scatterpolargl( r = df['Wind Speed (m/s)'], theta = df['Wind Direction (°)'], name = "Wind Speed", marker=dict(size=4, color="darkorange"), mode="markers" ), row=1, col=1) fig.add_trace(go.Histogram( x = df['Wind Speed (m/s)'], nbinsx=26, name='wind speed', marker_color='darkorange' ), row=1, col=2 ) fig.update_layout( title='Variation in wind speed with direction on a specific date', paper_bgcolor='#AFEEEE', ) # fig.update_traces() return fig
def vertex_trace(vertices, kwargs): r, theta = get_marker_coord(vertices, kwargs) size = get_marker_size(vertices, kwargs) color = get_marker_color(vertices, kwargs) name = get_marker_name(vertices, kwargs) trace = go.Scatterpolargl(r=r, theta=theta, mode='markers', hoverinfo='text+r+theta', hovertext=name, marker_cmin=0, marker_cmax=1, marker_colorscale='HSV_r', marker_size=size, marker_color=color, showlegend=False, marker_reversescale=True, marker_opacity=1, thetaunit='radians') return trace
def plot_wind_speed(df): fig = make_subplots(rows=1, cols=2, specs=[[{ 'type': 'polar' }, { 'type': 'xy' }]]) fig.add_trace(go.Scatterpolargl(r=df['Wind Speed (m/s)'], theta=df['Wind Direction (°)'], name="Wind Speed", marker=dict(size=5, color="mediumseagreen"), mode="markers"), row=1, col=1) fig.add_trace( go.Scatter(x=get_hours(), y=df['Wind Speed (m/s)'], mode='lines+markers', name='Theoretical_Power_Curve (KWh)', marker=dict(symbol="circle", color="mediumseagreen"))) fig.update_layout( title='Predicted wind speed and wind direction for next 72 hrs.', paper_bgcolor='#AFEEEE', legend=dict(orientation="h", yanchor="bottom", y=1.02, xanchor="right", x=1, bgcolor="LightSteelBlue", bordercolor="Black", borderwidth=2), xaxis_title='Time (in hours)', yaxis_title='Wind Speed(m/s)') return fig
def edge_trace_iterator(adjacency_list, vertices, kwargs): coord_transform = get_coord_transform_function(kwargs) line_function = get_line_function(kwargs) line_width_func = get_line_width_func(adjacency_list, kwargs) coordinates = ('r', 'theta') for vertex, neighbour, attributes in utils.edge_iterator(adjacency_list): if neighbour < vertex: coord_vertex = itemgetter(*coordinates)(vertices[vertex]) coord_neighbour = itemgetter(*coordinates)(vertices[vertex]) coord_vertex = coord_transform(*coord_vertex) coord_neighbour = coord_transform(*coord_neighbour) r, theta = line_function(*coord_vertex, *coord_neighbour) trace = go.Scatterpolargl(r=r, theta=theta, mode='lines', line_color='rgb(125,125,125)', hoverinfo='skip', line_width=line_width_func(attributes), thetaunit='radians') yield trace